Re: PoC: Make it possible to disallow WHERE-less UPDATE and DELETE

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
Cc: Julien Rouhaud <julien(dot)rouhaud(at)dalibo(dot)com>, David Fetter <david(at)fetter(dot)org>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PoC: Make it possible to disallow WHERE-less UPDATE and DELETE
Date: 2016-10-01 11:19:06
Message-ID: CAB7nPqT4j6Prwd4TxncSbSHudRUCfGqAYUGXLqG-C8y_oMzeQg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Oct 1, 2016 at 5:08 AM, Thomas Munro
<thomas(dot)munro(at)enterprisedb(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2016-10-01 12:15:05 Re: On conflict update & hint bits
Previous Message Dmitry Dolgov 2016-10-01 09:52:34 Re: [PATCH] Generic type subscription