Re: PoC: Make it possible to disallow WHERE-less UPDATE and DELETE
Michael Paquier <michael.paquier@gmail.com>
From: Michael Paquier <michael.paquier@gmail.com>
To: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: Julien Rouhaud <julien.rouhaud@dalibo.com>,
David Fetter <david@fetter.org>, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>,
Robert Haas <robertmhaas@gmail.com>, PostgreSQL Development <pgsql-hackers@postgresql.org>
Date: 2016-10-01T11:19:06Z
Lists: pgsql-hackers
On Sat, Oct 1, 2016 at 5:08 AM, Thomas Munro <thomas.munro@enterprisedb.com> wrote: > Right. These cases work because they show up as CMD_DELETE/CMD_UPDATE: > > postgres=# set require_where.delete = on; > SET > postgres=# with answer as (select 42) delete from foo; > ERROR: DELETE requires a WHERE clause when require_where.delete is set to on > HINT: To delete all rows, use "WHERE true" or similar. > postgres=# prepare x as delete from foo; > ERROR: DELETE requires a WHERE clause when require_where.delete is set to on > HINT: To delete all rows, use "WHERE true" or similar. Is this patch able to handle the case of DML queries using RETURNING in COPY? Those are authorized since 9.6, and it has not been mentioned yet on this thread. Going through the patch quickly I guess that would not work. -- Michael