-
Notifications
You must be signed in to change notification settings - Fork 212
Open
Description
See here the following A_Const node output: (all cases adhere to this pattern)
{"A_Const":{"ival":{"ival":1},"location":7}}Ideal output
I believe a more ideal output would be something like:
{"A_Const":{"val":{"Integer":{"ival":1}},"location":7}}This would match the protobuf definition, I think?
libpg_query/protobuf/pg_query.proto
Lines 314 to 325 in 680f5ee
| message A_Const | |
| { | |
| oneof val { | |
| Integer ival = 1; | |
| Float fval = 2; | |
| Boolean boolval = 3; | |
| String sval = 4; | |
| BitString bsval = 5; | |
| } | |
| bool isnull = 10; | |
| int32 location = 11; | |
| } |
Note that this appears to have been the output back in April 2021, as evidenced by this issue. I haven't tried to pinpoint where/when this behavior changed.
Root cause
I'm not familiar with the codebase, but this appears to be where the problem occurs:
libpg_query/src/pg_query_outfuncs_protobuf.c
Lines 192 to 198 in 680f5ee
| PgQuery__Integer *value = palloc(sizeof(PgQuery__Integer)); | |
| pg_query__integer__init(value); | |
| value->ival = node->val.ival.ival; | |
| out->val_case = PG_QUERY__A__CONST__VAL_IVAL; | |
| out->ival = value; | |
| break; |
Note that it's not just a problem with integers, but with all value types supported by A_Const.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels