From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: krking@zju.edu.cn
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17480: Assertion failure in parse_relation.c
Date: Tue, 10 May 2022 20:04:15 -0400
Message-ID: <27736.1652227455@sss.pgh.pa.us> (raw)
In-Reply-To: <202205101050.sepjyffoevsy@alvherre.pgsql>
References: <202205101050.sepjyffoevsy@alvherre.pgsql>
Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> and with this it is clear that the problem is that the alias list is too
> long for the COLUMNS specification of the XMLTABLE function.
Check.
> This can be avoided by throwing an error:
+1, but you should match the ERRCODE thrown by buildRelationAliases,
that is ERRCODE_INVALID_COLUMN_REFERENCE.
Looking at the other addRangeTableEntry* functions,
addRangeTableEntryForJoin seems to similarly lack a defense
against too many aliases. Testing shows that the case is covered
elsewhere:
regression=# select * from (int8_tbl i cross join int4_tbl j) ss(a,b,c,d) limit 2;
ERROR: column alias list for "ss" has too many entries
regression=# \errverbose
ERROR: 42601: column alias list for "ss" has too many entries
LOCATION: transformFromClauseItem, parse_clause.c:1458
but this is randomly different both in the message wording and in the
choice of ERRCODE. I wonder if we shouldn't harmonize that, and maybe
move detection of the case to addRangeTableEntryForJoin for consistency
with the other cases.
regards, tom lane
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-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, alvherre@alvh.no-ip.org, krking@zju.edu.cn, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17480: Assertion failure in parse_relation.c
In-Reply-To: <27736.1652227455@sss.pgh.pa.us>
* 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