-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parser incorrectly parses queries with negative and zero values #243
Comments
MGorkov
changed the title
Parser incorrectly parses queris with negative and zero values
Parser incorrectly parses queries with negative and zero values
Apr 16, 2024
msullivan
added a commit
to msullivan/libpg_query
that referenced
this issue
May 9, 2024
Currently the value of negative constants are omitted. Only omit *0* constants. An earlier attempt (pganalyze#244) caused a mismatch with the protobuf json output, since that wants to omit values that are equal to the default value. I don't *really* think that is particularly sensible behavior for an integer constant in an AST, but oh well. Fixes pganalyze#243.
msullivan
added a commit
to msullivan/libpg_query
that referenced
this issue
May 9, 2024
Currently the value of negative constants are omitted. Only omit *0* constants. An earlier attempt (pganalyze#244) caused a mismatch with the protobuf json output, since that wants to omit values that are equal to the default value. I don't *really* think that is particularly sensible behavior for an integer constant in an AST, but oh well. Fixes pganalyze#243.
msullivan
added a commit
to msullivan/libpg_query
that referenced
this issue
May 9, 2024
Currently the value of negative constants are omitted. Only omit *0* constants. An earlier attempt (pganalyze#244) caused a mismatch with the protobuf json output, since that wants to omit values that are equal to the default value. I don't *really* think that is particularly sensible behavior for an integer constant in an AST, but oh well. Fixes pganalyze#243.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The text was updated successfully, but these errors were encountered: