On Thu, Dec 7, 2023 at 7:39 PM jian he <jian.universal...@gmail.com> wrote: > based on: > json_behavior_clause_opt: > json_behavior ON EMPTY_P > { $$ = list_make2($1, NULL); } > | json_behavior ON ERROR_P > { $$ = list_make2(NULL, $1); } > | json_behavior ON EMPTY_P json_behavior ON ERROR_P > { $$ = list_make2($1, $4); } > | /* EMPTY */ > { $$ = list_make2(NULL, NULL); } > ; > so > + if (func->behavior) > + { > + on_empty = linitial(func->behavior); > + on_error = lsecond(func->behavior); > + }
Yeah, maybe. > `if (func->behavior)` will always be true? > By the way, in the above "{ $$ = list_make2($1, $4); }" what does $4 > refer to? (I don't know gram.y....) $1 and $4 refer to the 1st and 4th symbols in the following: json_behavior ON EMPTY_P json_behavior ON ERROR_P So $1 gives the json_behavior (JsonBehavior) node for ON EMPTY and $4 gives that for ON ERROR. -- Thanks, Amit Langote EDB: http://www.enterprisedb.com