Reject non-ON-SELECT rules that are named "_RETURN".
authorTom Lane <[email protected]>
Mon, 17 Oct 2022 16:14:39 +0000 (12:14 -0400)
committerTom Lane <[email protected]>
Mon, 17 Oct 2022 16:14:39 +0000 (12:14 -0400)
commitecf4ce689a7c3d91b912f3f41d8502f322592619
tree02b17e1512086c312fdaa5baf8cac5c299da161d
parent02d074e3ebca1ac0ccdc28a5ecf83ecf117d35b9
Reject non-ON-SELECT rules that are named "_RETURN".

DefineQueryRewrite() has long required that ON SELECT rules be named
"_RETURN".  But we overlooked the converse case: we should forbid
non-ON-SELECT rules that are named "_RETURN".  In particular this
prevents using CREATE OR REPLACE RULE to overwrite a view's _RETURN
rule with some other kind of rule, thereby breaking the view.

Per bug #17646 from Kui Liu.  Back-patch to all supported branches.

Discussion: https://postgr.es/m/17646-70c93cfa40365776@postgresql.org
src/backend/rewrite/rewriteDefine.c