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

Craig Ringer <craig@2ndquadrant.com>

From: Craig Ringer <craig@2ndquadrant.com>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: David Fetter <david@fetter.org>, PostgreSQL Development <pgsql-hackers@postgresql.org>
Date: 2016-07-21T13:29:12Z
Lists: pgsql-hackers
On 21 July 2016 at 15:49, Amit Kapila <amit.kapila16@gmail.com> wrote:

> On Thu, Jul 21, 2016 at 10:27 AM, David Fetter <david@fetter.org> wrote:
> > Folks,
> >
> > Please find attached a patch which makes it possible to disallow
> > UPDATEs and DELETEs which lack a WHERE clause.  As this changes query
> > behavior, I've made the new GUCs PGC_SUSET.
> >
> > What say?
> >
>
> The use case for this functionality that comes to mind is to avoid
> deleting/updating all the data, if user has accidentally missed the
> WHERE clause.  Do you have other use case for this functionality?
> With this functionality, if user needs to actually delete or update
> all the rows, then he has to artificially add where clause which seems
> slightly inconvenient, but may be such cases are less.


It's a commonly requested feature. Personally I think it's kind of silly,
but I've had multiple people ask me for it or how to do it too. So whether
or not it's really effective/useful, it's in demand.

Personally I'd rather see it as part of an extension that does other
filtering, I don't find it compelling for core. But I don't really object
either.

-- 
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services