pganalyze / libpg_query

C library for accessing the PostgreSQL parser outside of the server environment
BSD 3-Clause "New" or "Revised" License
1.21k stars 182 forks source link

Parser incorrectly parses queries with negative and zero values #243

Closed MGorkov closed 2 months ago

MGorkov commented 7 months ago

The following queries produces an invalid tree when run through the parser : SELECT 0; SELECT -1;

Parser output: { version: 160001, stmts: [ { stmt: { SelectStmt: { targetList: [ { ResTarget: { val: { A_Const: { ival: {}, location: 7 } }, location: 7 } } ], limitOption: 'LIMIT_OPTION_DEFAULT', op: 'SETOP_NONE' } } } ] } In version 15 these queries also produce incorrect tree, but version 14 is correct.