pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix inability to reference CYCLE column from inside its CTE.
Date: Fri, 16 Dec 2022 18:07:54 +0000
Message-ID: <E1p6F7h-003vca-Ky@gemulon.postgresql.org> (raw)

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(-)



view thread (3+ messages)

Message-ID: <E1p6F7h-003vca-Ky@gemulon.postgresql.org>
Permalink:  ../E1p6F7h-003vca-Ky@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1p6F7h-003vca-Ky@gemulon.postgresql.org

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix inability to reference CYCLE column from inside its CTE.
  In-Reply-To: <E1p6F7h-003vca-Ky@gemulon.postgresql.org>
  References: <E1p6F7h-003vca-Ky@gemulon.postgresql.org>

* 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