agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Disallow renaming a rule to "_RETURN".
Date: Sat, 04 Jul 2026 15:34:46 +0000
Message-ID: <E1wg2OE-001K7S-1k@gemulon.postgresql.org> (raw)

Disallow renaming a rule to "_RETURN".

ON SELECT rules must be named "_RETURN", while other kinds of rules
must not be; this ancient restriction is depended on by various client
code.  We successfully enforced this convention in most places, but
ALTER RULE allowed renaming a non-SELECT rule to "_RETURN".  Notably,
that would break dump/restore, since the eventual CREATE RULE command
would reject the name.

While at it, remove DefineQueryRewrite's hack to substitute "_RETURN"
for the convention that was used before 7.3.  We dropped other
server-side code that supported restoring pre-7.3 dumps some time ago
(notably in e58a59975 and nearby commits), but this bit was missed.

Bug: #19543
Reported-by: Adam Pickering <adamkpickering@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19543-461228e77f3b32fc@postgresql.org
Backpatch-through: 14

Branch
------
REL_17_STABLE

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

Modified Files
--------------
src/backend/rewrite/rewriteDefine.c | 36 ++++++++++++++++--------------------
src/test/regress/expected/rules.out |  2 ++
src/test/regress/sql/rules.sql      |  1 +
3 files changed, 19 insertions(+), 20 deletions(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1wg2OE-001K7S-1k@gemulon.postgresql.org>
Permalink:  ../E1wg2OE-001K7S-1k@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wg2OE-001K7S-1k@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 renaming a rule to "_RETURN".
  In-Reply-To: <E1wg2OE-001K7S-1k@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