/pub/lqs-uma-ferramenta-prtica-para-testar-sql.md


LQS: A Practical Tool for Testing and Debugging SQL

· updated 2026-08-28 · #golang #golang-study-group #development #sql #lua

It’s very common to need to embed SQL code strings in the source of other languages. The problem is that SQL is an interpreted language, so it can contain errors that we only notice at runtime.

Testing SQL

LQS was created to work together with Neovim and allow you to test SQL while editing, without having to copy and paste into another file or SQL client.

Integration with Neovim

Integration with Neovim is simple—just one function. It allows you to select part of your SQL script in the editor and, with a quick command, run the query and view the result in a new buffer. This automation makes development much more fluid. If an error occurs, the error message will be displayed.

In lqs.lua, you’ll find an example of how to create a custom command in Neovim to capture the selection, save it to a temporary file, and automatically run LQS.

How It Works

LQS reads the SQL file and processes each line to extract parameters:

Conclusion

If you work with embedded SQL or need to test queries quickly, give LQS a try. It allows you to catch SQL errors as you edit your code and can also serve as a handy form of documentation, a simple approach to literate programming.

And yes, LQS is SQL spelled backwards. We shouldn’t let programmers name things.


References:

Cesar Gimenes


crg.eti.br · © 2026 Cesar Gimenes · CC BY 4.0 · github · pt