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: Disallow NAMEDTUPLESTORE RTEs in stored views, rules, etc.
Date: Wed, 08 Jan 2025 21:36:00 +0000
Message-ID: <E1tVdia-000YT8-JC@gemulon.postgresql.org> (raw)

Disallow NAMEDTUPLESTORE RTEs in stored views, rules, etc.

A named tuplestore is necessarily a transient object, so it makes
no sense to reference one in a persistent object such as a view.
We didn't previously prevent that, with the result that if you
tried you would get some weird failure about how the executor
couldn't find the tuplestore.

We can mechanize a check for this case cheaply by making dependency
extraction complain if it comes across such an RTE.  This is a
plausible way of dealing with it since part of the problem is that we
have no way to make a pg_depend representation of a named tuplestore.

Report and fix by Yugo Nagata.  Although this is an old problem,
it's a very weird corner case and there have been no reports from
end users.  So it seems sufficient to fix it in master.

Discussion: https://postgr.es/m/20240726160714.e74d0db579f2c017e1ca0b7e@sraoss.co.jp

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3c49d462dbcfaff7bb77b1fec2c73c1079d25433

Modified Files
--------------
src/backend/catalog/dependency.c       | 15 +++++++++++++++
src/test/regress/expected/triggers.out | 20 ++++++++++++++++++++
src/test/regress/sql/triggers.sql      | 19 +++++++++++++++++++
3 files changed, 54 insertions(+)



Message-ID: <E1tVdia-000YT8-JC@gemulon.postgresql.org>
Permalink:  ../E1tVdia-000YT8-JC@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1tVdia-000YT8-JC@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: Disallow NAMEDTUPLESTORE RTEs in stored views, rules, etc.
  In-Reply-To: <E1tVdia-000YT8-JC@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