pgsql: Fix inability to reference CYCLE column from inside its CTE.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix inability to reference CYCLE column from inside its CTE.
Date: 2022-12-16 18:07:54
Message-ID: E1p6F7h-003vca-Ky@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix inability to reference CYCLE column from inside its CTE.

Such references failed with "cache lookup failed for type 0"
because we didn't resolve the type of the CYCLE column until after
analyzing the CTE's query. We can just move that processing
to before the recursive parse_sub_analyze call, though.

While here, invent a couple of local variables to make this
code less egregiously wider-than-80-columns.

Per bug #17723 from Vik Fearing. Back-patch to v14 where
the CYCLE feature was added.

Discussion: https://postgr.es/m/17723-2c4985ff111e7bba@postgresql.org

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/ae98debf77d4aba7caa305fa4957577528699470

Modified Files
--------------
src/backend/parser/parse_cte.c | 170 +++++++++++++++++++++----------------
src/test/regress/expected/with.out | 23 +++++
src/test/regress/sql/with.sql | 9 ++
3 files changed, 129 insertions(+), 73 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2022-12-17 15:31:46 pgsql: Doc: update pg_list.h header comments to include XidLists.
Previous Message Peter Eisentraut 2022-12-16 17:38:35 pgsql: pg_upgrade: Make testing different transfer modes easier