From: Евгений Горбанев <gorbanyoves@basealt.ru>
To: Richard Guo <guofenglinux@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Assert failure in base_yyparse
Date: Fri, 28 Mar 2025 16:12:37 +0600
Message-ID: <62d5fa6e-4fe5-4527-a0a2-5dd32e6b3cf7@basealt.ru> (raw)
In-Reply-To: <CAMbWs49Z4OV77=9mD0BgHqSUOdLdO3YkbQVunCAgfFKU2WcjVA@mail.gmail.com>
References: <6bac9886-65bf-4cec-96bd-e304159f28db@basealt.ru>
<CAMbWs4-9Zde_MU8h-hvfGv6gpi98ZWUFTwESN3DaS0hzJECAww@mail.gmail.com>
<CAMbWs49Z4OV77=9mD0BgHqSUOdLdO3YkbQVunCAgfFKU2WcjVA@mail.gmail.com>
> 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 <guofenglinux@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
Attachments:0001-Fix-usage-of-is_not_null-in-xmltable.patch (text/x-patch, 1.1K) download
From de66a7ac776b827cba748e0a358b6d3911790e23 Mon Sep 17 00:00:00 2001
From: Evgeniy Gorbanev <gorbanyoves@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.yindex 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: gorbanyoves@basealt.ru, guofenglinux@gmail.com, pgsql-hackers@lists.postgresql.org
Subject: Re: Assert failure in base_yyparse
In-Reply-To: <62d5fa6e-4fe5-4527-a0a2-5dd32e6b3cf7@basealt.ru>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox