Re: BUG #17480: Assertion failure in parse_relation.c
От | Alvaro Herrera |
---|---|
Тема | Re: BUG #17480: Assertion failure in parse_relation.c |
Дата | |
Msg-id | 202205151042.jjhnmhpsanbl@alvherre.pgsql обсуждение исходный текст |
Ответ на | Re: BUG #17480: Assertion failure in parse_relation.c (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: BUG #17480: Assertion failure in parse_relation.c
|
Список | pgsql-bugs |
On 2022-May-10, Tom Lane wrote: > 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. That makes sense; I ended up with the attached patch, in which I also attempt to add regression test cases to cover all the cases. I find that the check in addRangeTableEntryForValues is dead code, because both callers pass a NULL Alias. I find no way to give VALUES an alias directly. This has annoyed me in the past (not a big deal tbh), but that makes me refrain from suggesting to removing the code. We do get the correct error with this query, select * from (values (1)) as f (a, b); but that is coming from addRangeTableEntryForSubquery. This is backpatchable (sans the JSON_TABLE bits). I'll attempt to get it pushed later today. -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/ "People get annoyed when you try to debug them." (Larry Wall)
Вложения
В списке pgsql-bugs по дате отправления: