Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
libpg-query
Advanced tools
Readme
The real PostgreSQL parser, exposed for nodejs.
Primarily used for the node.js parser and deparser pgsql-parser
npm install libpg-query
const parser = require('libpg-query');
parser.parseQuery('select 1').then(console.log);
query.parseQuery(sql)
/parseQuerySync
Parses the sql and returns a Promise for the parse tree (or returns the parse tree directly in the sync version). May reject with/throw a parse error.
The return value is an array, as multiple queries may be provided in a single string (semicolon-delimited, as Postgres expects).
query.parsePlPgSQL(funcsSql)
/query.parsePlPgSQLSync(funcsSql)
Parses the contents of a PL/PGSql function, from a CREATE FUNCTION
declaration, and returns a Promise for the parse tree (or returns the parse tree directly in the sync version). May reject with/throw a parse error.
Our latest is built with 16-latest
branch from libpg_query
PG Major Version | libpg_query | Branch | npm |
---|---|---|---|
16 | 16-latest | 16-latest | libpg-query@16.0.0 |
15 | 15-latest | 15-latest | libpg-query@15.0.3 |
14 | 14-latest | 14-latest | libpg-query@14.0.0 |
13 | 13-latest | 13-latest | libpg-query@13.3.1 |
12 | (n/a) | ||
11 | (n/a) | ||
10 | 10-latest | @1.3.1 (tree) |
npm i
)npx node-pre-gyp rebuild package
npx node-pre-gyp publish
Or you can run the scripts
npm run binary:build
npm run binary:publish
This is based on the output of libpg_query. This wraps the static library output and links it into a node module for use in js.
All credit for the hard problems goes to Lukas Fittl.
Additional thanks for node binding Ethan Resnick.
FAQs
The real PostgreSQL query parser
The npm package libpg-query receives a total of 15,115 weekly downloads. As such, libpg-query popularity was classified as popular.
We found that libpg-query demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.