The real PostgreSQL query parser
npm install pg-query-nativeThe real PostgreSQL parser for nodejs.
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.
``sh`
npm install pg-query-native
Parses the query and returns the parse tree.
| parameter | type | description |
| -------------------- | ------------------ | --------------------------------------------------------- |
| query | String | SQL query |
Returns an object in the format:
``
{ query:
error: { message:
fileName:
lineNumber:
cursorPosition:
`js
var parse = require('pg-query-native').parse;
console.log(parse('select 1').query);
``