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

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: David Fetter <david(at)fetter(dot)org>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PoC: Make it possible to disallow WHERE-less UPDATE and DELETE
Date: 2016-07-21 13:29:12
Message-ID: CAMsr+YH+L+hhHhuy+ZQBvNvEW0UkjTzE3pUM9biraXxrm13gpg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 21 July 2016 at 15:49, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:

> On Thu, Jul 21, 2016 at 10:27 AM, David Fetter <david(at)fetter(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2016-07-21 13:32:08 Re: [BUG] pg_basebackup from disconnected standby fails
Previous Message Jim Mlodgenski 2016-07-21 13:21:55 Re: PoC: Make it possible to disallow WHERE-less UPDATE and DELETE