Enforce WITH CHECK OPTION on DELETE FOR PORTION OF leftovers

DELETE FOR PORTION OF inserts temporal leftovers through ExecInsert(),
but the rewriter only attached view WCOs for INSERT/UPDATE.  Leftover
rows could therefore silently escape a WITH CHECK OPTION view, while
the equivalent UPDATE correctly raised an error.

This commit fixes it by attaching the WCOs for FOR PORTION OF deletes
too.

Author: Zsolt Parragi <[email protected]>
Co-authored-by: Paul A Jungwirth <[email protected]>
Reviewed-by: solai v <[email protected]>
Reviewed-by: Dean Rasheed <[email protected]>
Discussion: 
https://www.postgresql.org/message-id/flat/CAN4CZFOuTyhGspG0Nyits8PiK2keoNXkLj-u3APzc66aRcWY9A%40mail.gmail.com

Branch
------
REL_19_STABLE

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

Modified Files
--------------
doc/src/sgml/ref/create_view.sgml             | 20 ++++++----
src/backend/rewrite/rewriteHandler.c          |  8 +++-
src/test/regress/expected/updatable_views.out | 56 +++++++++++++++++++++++++++
src/test/regress/sql/updatable_views.sql      | 29 ++++++++++++++
4 files changed, 104 insertions(+), 9 deletions(-)

Reply via email to