]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Disallow renaming a rule to "_RETURN".
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 4 Jul 2026 15:34:26 +0000 (11:34 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 4 Jul 2026 15:34:26 +0000 (11:34 -0400)
commit1b17a6e3cd89f76ea5db6260c79db620d5a7793b
tree644cecc494991056b8e81a9b85973d5ab239c6f6
parent286f9a3cec4b9c4b1d1c49d0b35b6ef074ed2629
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
src/backend/rewrite/rewriteDefine.c
src/test/regress/expected/rules.out
src/test/regress/sql/rules.sql