Re: Assert failure in base_yyparse

Richard Guo <guofenglinux@gmail.com>

From: Richard Guo <guofenglinux@gmail.com>
To: Евгений Горбанев <gorbanyoves@basealt.ru>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2025-03-28T09:05:48Z
Lists: pgsql-hackers
On Fri, Mar 28, 2025 at 4:40 PM Евгений Горбанев <gorbanyoves@basealt.ru> wrote:
> Got an assert failure when fuzzing the raw_parser function.
> The query to reproduce:
> SELECT xmltable.* FROM xmltest2, LATERAL xmltable('/d/r' PASSING x
> COLUMNS a int PATH '' || lower(_path) is_not_null|| 'c');
>
> If I understand correctly, is_not_null is considered as a valid keyword
> in xmltable, but it gets the type T_A_Expr.

> Prepared a patch to fix it, but there may be a better solution.

Nice catch.  Yeah, is_not_null is a valid column option in xmltable.
In you example, the value of the is_not_null option is "|| 'c'", which
is interpreted as an A_Expr.

I wonder if the value's type should be checked earlier, rather than at
the last minute.

Also, I think IsA is a better choice for checking the node type.

Thanks
Richard



Commits

  1. Fix Assert failure in XMLTABLE parser