From a6bc3301925e1a8ad1f58da629b9dd55bc4b8d9c Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sat, 24 Sep 2022 18:18:33 -0400 Subject: Add read support for some missing raw parse nodes The node types A_Const, Constraint, and A_Expr had custom output functions, but no read functions were implemented so far. The A_Expr output format had to be tweaked a bit to make it easier to parse. Be a bit more cautious about applying strncmp to unterminated strings. Also error out if an unrecognized enum value is found in each case, instead of just printing a placeholder value. That was maybe ok for debugging but won't work if we want to have robust round-tripping. Reviewed-by: Tom Lane Discussion: https://www.postgresql.org/message-id/flat/4159834.1657405226@sss.pgh.pa.us --- src/include/nodes/parsenodes.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/include/nodes') diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 6958306a7d..aead2afd6e 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -291,7 +291,7 @@ typedef enum A_Expr_Kind typedef struct A_Expr { - pg_node_attr(custom_read_write, no_read) + pg_node_attr(custom_read_write) NodeTag type; A_Expr_Kind kind; /* see above */ @@ -319,7 +319,7 @@ union ValUnion typedef struct A_Const { - pg_node_attr(custom_copy_equal, custom_read_write, no_read) + pg_node_attr(custom_copy_equal, custom_read_write) NodeTag type; union ValUnion val; @@ -2332,7 +2332,7 @@ typedef enum ConstrType /* types of constraints */ typedef struct Constraint { - pg_node_attr(custom_read_write, no_read) + pg_node_attr(custom_read_write) NodeTag type; ConstrType contype; /* see above */ -- cgit v1.2.1