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 <[email protected]>
Author: Tom Lane <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 14

Branch
------
REL_16_STABLE

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

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(-)

Reply via email to