pganalyze/pg-query-emscripten

Emscripten Port of pg_query to easily play with it in the browser

C++

91

57 commits

updated Dec 11, 2025

See the code

README

pg-query-emscripten

Parse any valid PostgreSQL query in your browser using Javascript!

This builds a pure Javascript port of libpg_query using emscripten, that allows you to parse SQL in the browser into the PostgreSQL parse tree.

Example use cases might include automatically checking for bad query patterns (e.g. LIMIT/OFFSET), understanding which tables a query references, or using structural pg_dump output to produce a schema diagram on the fly.

Usage

npm install pg-query-emscripten --save
import Module from "pg-query-emscripten";

let pgQuery;

(async () => {
  pgQuery = await new Module();

  console.log(pgQuery.parse("select 1"));
})();

Author

LICENSE

Copyright (c) 2018 Lukas Fittl
Licensed under the MIT License.

Contributors

lfittl

35 commits

PhilipTrauner

18 commits

nothingisdead

3 commits

EliSnow

1 commits

pganalyze/pg-query-emscripten

Emscripten Port of pg_query to easily play with it in the browser

C++

91

57 commits

updated Dec 11, 2025

See the code

README

pg-query-emscripten

Parse any valid PostgreSQL query in your browser using Javascript!

This builds a pure Javascript port of libpg_query using emscripten, that allows you to parse SQL in the browser into the PostgreSQL parse tree.

Example use cases might include automatically checking for bad query patterns (e.g. LIMIT/OFFSET), understanding which tables a query references, or using structural pg_dump output to produce a schema diagram on the fly.

Usage

npm install pg-query-emscripten --save
import Module from "pg-query-emscripten";

let pgQuery;

(async () => {
  pgQuery = await new Module();

  console.log(pgQuery.parse("select 1"));
})();

Author

LICENSE

Copyright (c) 2018 Lukas Fittl
Licensed under the MIT License.

Contributors

lfittl

35 commits

PhilipTrauner

18 commits

nothingisdead

3 commits

EliSnow

1 commits

Languages

C++

44.8%

JavaScript

32.5%

Makefile

22.7%