Also, I think IsA is a better choice for checking the node type.
Agree, IsA is better. Fixed in the patch.
On Fri, Mar 28, 2025 at 6:05 PM Richard Guo <guofengli...@gmail.com> wrote: Hmm, I wonder if we should allow the use of the 'is_not_null' keyword in xmltable. According to the doc, it seems that users should declare NULL or NOT NULL for a column by specifying [NOT NULL | NULL] for the column. Thanks Richard
If you replace is_not_null with NOT NULL in the query, everything works correctly. It seems that is_not_null is an incorrect keyword and it should not be used, but I don't understand how it gets here.
Best regards, Evgeniy
From de66a7ac776b827cba748e0a358b6d3911790e23 Mon Sep 17 00:00:00 2001 From: Evgeniy Gorbanev <gorbanyo...@basealt.ru> Date: Fri, 28 Mar 2025 15:54:37 +0600 Subject: [PATCH] Fix usage of is_not_null in xmltable is_not_null is considered as a valid keyword in xmltable, but it gets the type T_A_Expr --- src/backend/parser/gram.y | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index 0fc502a3a40..84762c2511b 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -14232,6 +14232,11 @@ xmltable_column_el: (errcode(ERRCODE_SYNTAX_ERROR), errmsg("conflicting or redundant NULL / NOT NULL declarations for column \"%s\"", fc->colname), parser_errposition(defel->location))); + if (!IsA(defel->arg, Boolean)) + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("syntax error at or near \"%s\"", defel->defname), + parser_errposition(defel->location))); fc->is_not_null = boolVal(defel->arg); nullability_seen = true; } -- 2.42.2