agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: pg_get_viewdef() and lateral references in COLUMNS of GRAPH_TABL
Date: Fri, 24 Apr 2026 07:17:43 +0000
Message-ID: <E1wGAnH-002TIZ-0J@gemulon.postgresql.org> (raw)

pg_get_viewdef() and lateral references in COLUMNS of GRAPH_TABLE

Expressions in GRAPH_TABLE COLUMNS list may have lateral references.
get_rule_expr() requires lateral namespaces to deparse such
references.  get_from_clause_item() does not pass them when processing
the expressions in COLUMNS list causing ERROR "bogus varlevelsup: 0
offset 0".  Fix get_from_clause_item() to pass input deparse_context
containing lateral namespaces to get_rule_expr() instead of the dummy
context.

Author: Satyanarayana Narlapuram <satyanarlapuram@gmail.com>
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CAHg%2BQDcLVa2iBnggkHxY4itZbXtDMfsYHEjnCUYe9hNbnxDi-w%40m...

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9d2979dd6856e160f35544d79eb11f2c68c30985

Modified Files
--------------
src/backend/utils/adt/ruleutils.c         | 10 ++--------
src/test/regress/expected/graph_table.out | 26 ++++++++++++++++++--------
src/test/regress/sql/graph_table.sql      | 12 ++++++++++--
3 files changed, 30 insertions(+), 18 deletions(-)



Message-ID: <E1wGAnH-002TIZ-0J@gemulon.postgresql.org>
Permalink:  ../E1wGAnH-002TIZ-0J@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wGAnH-002TIZ-0J@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: peter@eisentraut.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: pg_get_viewdef() and lateral references in COLUMNS of GRAPH_TABL
  In-Reply-To: <E1wGAnH-002TIZ-0J@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox