A language server for SQL, written in Rust, that speaks LSP over stdio. It reads SQLite 3.47 and newer, MySQL 8.0 and newer, MariaDB 11.0 and newer and PostgreSQL 18, with one parser for all of them and a table that says which syntax each version of each dialect accepts. It never connects to a database and never holds a credential.
It reports syntax errors and runs inspections for what a database IDE flags: syntax a dialect or version does not accept or deprecates, unknown and ambiguous names, columns missing from GROUP BY, DELETE without WHERE, = NULL, column counts, values a column cannot hold, unused and duplicate names and the pitfalls of MySQL, each with a stable id, a setting, a suppression comment and, where an obvious one exists, a quick fix. It completes tables, columns, join conditions from foreign keys, functions, types and keywords for the dialect and version, describes tables, columns and functions on hover, goes to definitions, and helps with the parameters of a call. It finds the references of a table, column, alias or routine across the workspace's .sql files, renames what DDL in them defines, highlights a name's reads and writes, colors names by what they stand for, shows the column each value of an INSERT goes to, formats scripts without ever changing a token, and offers rewrites and quick fixes. What it knows about a schema comes from a snapshot file a host writes and from the DDL of the workspace's .sql files. CLAUDE.md lists the phases.
The same binary checks, formats and describes from a shell (sql-language-server check, format, describe; see the command line), so an agent without LSP can lint a migration or look up a table. Another language server reads SQL inside its own strings through the sql-embed crate, with every answer in its own offsets (embedding); the PHP language server does so for the queries of a PHP project.
Build it with Rust 1.85 or newer:
cargo build --release --lockedThe binary lands in target/release/sql-language-server. No database is needed, to build or to run.
sql-language-server --stdio
sql-language-server check --dialect mysql db/ queries/| Page | What it covers |
|---|---|
| Getting started | Building, starting and connecting |
| Configuration | Dialect, version and schema snapshot per file or folder |
| Snapshot format | The JSON a host writes for a database's schema |
| Features | What it answers and what it reports |
| Inspections | Every inspection, its severity, settings, suppression and fixes |
| Clients | What an editor sends and announces for each feature |
| Command line | check, format and describe, their output and exit codes |
| Embedding | SQL in another language's strings: fragments, offsets, the answers |
| Distribution | Release archives and the descriptor an installer pins |
| Maintaining | The crates, checks, the corpora against real servers and releases |
NATIVE.md describes how the implementation works and why, and MEASUREMENTS.md what it was measured to do.
Functional Source License, Version 1.1, MIT Future License. The database servers the corpus check runs are downloaded separately and keep their own licenses; see THIRD-PARTY.md.