---
title: "Postgres Language Server: Initial Release"
description: "Postgres Language Server is an LSP implementation for Postgres offering autocompletion, syntax error highlighting, type-checking via PREPARE/EXPLAIN against a live database, and a Squawk-inspired linter, available for VSCode, Neovim and as a CLI."
url: "https://swe.quest/articles/postgres-language-server-initial-release-4b7148c84b3bcff0"
canonical: "https://supabase.com/blog/postgres-language-server"
source: "Supabase"
published: "2025-03-29"
difficulty: "medium"
kind: "Deep dive"
reading_minutes: 13
tags: ["postgres","developer-tools","rust","sql","static-analysis"]
---

# Postgres Language Server: Initial Release

A post on [Supabase](https://swe.quest/sources/supabase.md), published 2025-03-29, 13 min read, Deep dive. Original: [https://supabase.com/blog/postgres-language-server](https://supabase.com/blog/postgres-language-server)

## Summary

Postgres Language Server is an LSP implementation for Postgres offering autocompletion, syntax error highlighting, type-checking via PREPARE/EXPLAIN against a live database, and a Squawk-inspired linter, available for VSCode, Neovim and as a CLI. Its architecture treats each SQL statement as an independent compilation unit with the database schema as the source of truth. A custom Pratt-parser statement splitter falls back to semicolons and double newlines. libpg\_query handles precise parsing of valid SQL, while tree-sitter covers incomplete input for autocompletion. On edits, only changed statements are invalidated and later statements just have their ranges shifted, so cached ASTs survive. Completions are scored from a lazily loaded in-memory schema cache, so no database query is needed per keystroke.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Developer tools](https://swe.quest/tags/developer-tools.md) (Engineering practices)
- [Rust](https://swe.quest/tags/rust.md) (Languages)
- [SQL](https://swe.quest/tags/sql.md) (Languages)
- [Static analysis](https://swe.quest/tags/static-analysis.md) (Engineering practices)

## Prerequisites

- Language Server Protocol basics
- SQL and Postgres ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))
- parsers and syntax trees

## Keywords

Postgres Language Server, LSP, libpg\_query, tree-sitter, Squawk, Pratt parser, Supabase

## Related posts

- [Postgres Language Server: implementing the Parser](https://swe.quest/articles/postgres-language-server-implementing-the-parser-3a3e33745c9c0915.md): Supabase · 2023-12-08 · Hard · 14 min read · PostgreSQL, Compilers, Rust, Developer tools, SQL
  A Postgres language server's parser builds on libpg\_query rather than a custom grammar, and has to work around two gaps in it.
- [We're building Postgres in Rust. Using the LLVM of databases](https://swe.quest/articles/we-re-building-postgres-in-rust-using-the-llvm-of-databases-e44d34208278a99e.md): Turso · 2026-07-16 · Easy · 11 min read · PostgreSQL, SQLite, Rust, Query engines, Open source
  Turso, a Rust rewrite of SQLite, is adding a Postgres frontend by parsing Postgres SQL into a common AST and compiling it to Turso's VDBE bytecode, turning the engine into an "LLVM of databases" with pluggable frontends.
- [dbdev: PostgreSQL Package Manager](https://swe.quest/articles/dbdev-postgresql-package-manager-58df87ba3a3de7e4.md): Supabase · 2023-04-14 · Medium · 7 min read · PostgreSQL, Build systems, Open source
  database.dev (dbdev) is a read-only preview of a package manager for PostgreSQL, playing the role npm or cargo play for other languages.
- [Bringing psql’s \\d to your web browser](https://swe.quest/articles/bringing-psql-s-d-to-your-web-browser-032015b940df37e2.md): Neon · 2024-04-17 · Medium · 6 min read · PostgreSQL, JavaScript, Developer tools
  Neon's web SQL Editor now supports psql backslash introspection commands like \\d, \\l, \\dx and \\sf, which live in psql's C client code rather than the Postgres server.
- [What To Know About Postgres if You’re Coming From SQL Server](https://swe.quest/articles/what-to-know-about-postgres-if-you-re-coming-from-sql-server-2dbf370eb4f4c29d.md): Neon · 2024-12-10 · Medium · 9 min read · PostgreSQL, SQL, Databases
  Postgres and SQL Server share SQL but differ in dialect details that trip up migrating developers.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
