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: Track nesting depth correctly when drilling down into RECORD Var
Date: Fri, 15 Sep 2023 21:02:06 +0000
Message-ID: <E1qhFx0-0042tZ-Gj@gemulon.postgresql.org> (raw)

Track nesting depth correctly when drilling down into RECORD Vars.

expandRecordVariable() failed to adjust the parse nesting structure
correctly when recursing to inspect an outer-level Var.  This could
result in assertion failures or core dumps in corner cases.

Likewise, get_name_for_var_field() failed to adjust the deparse
namespace stack correctly when recursing to inspect an outer-level
Var.  In this case the likely result was a "bogus varno" error
while deparsing a view.

Per bug #18077 from Jingzhou Fu.  Back-patch to all supported
branches.

Richard Guo, with some adjustments by me

Discussion: https://postgr.es/m/18077-b9db97c6e0ab45d8@postgresql.org

Branch
------
master

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

Modified Files
--------------
src/backend/parser/parse_target.c      | 17 +++++++---
src/backend/utils/adt/ruleutils.c      | 37 ++++++++++++---------
src/test/regress/expected/rowtypes.out | 60 ++++++++++++++++++++++++++++++++++
src/test/regress/sql/rowtypes.sql      | 25 ++++++++++++++
4 files changed, 119 insertions(+), 20 deletions(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1qhFx0-0042tZ-Gj@gemulon.postgresql.org>
Permalink:  ../E1qhFx0-0042tZ-Gj@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qhFx0-0042tZ-Gj@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: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Track nesting depth correctly when drilling down into RECORD Var
  In-Reply-To: <E1qhFx0-0042tZ-Gj@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