| From: | David Fetter <david(at)fetter(dot)org> | 
|---|---|
| To: | David Fetter <david(at)fetter(dot)org> | 
| Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Teodor Sigaev <teodor(at)sigaev(dot)ru>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | Re: PoC: Make it possible to disallow WHERE-less UPDATE and DELETE | 
| Date: | 2016-07-22 06:38:43 | 
| Message-ID: | 20160722063843.GB2070@fetter.org | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
On Thu, Jul 21, 2016 at 09:52:26AM -0700, David Fetter wrote:
> On Thu, Jul 21, 2016 at 12:46:29PM -0400, Robert Haas wrote:
> > On Thu, Jul 21, 2016 at 12:39 PM, David Fetter <david(at)fetter(dot)org> wrote:
> > > On Thu, Jul 21, 2016 at 06:20:37PM +0300, Teodor Sigaev wrote:
> > >> > 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?
> > >>
> > >> DELETE FROM tbl WHERE true; ?
> > >
> > > I specifically left this possible so the feature when turned on allows
> > > people to do updates with an always-true qualifier if that's what they
> > > actually mean to do.
> > >
> > > In case it wasn't clear, unqualified updates and deletes are permitted
> > > by default.  This patch allows people to set it so they're disallowed.
> > 
> > I join with others in thinking it's a reasonable contrib module.  In
> > fact, I already wrote it for my 2015 PGCon tutorial.  Well, the
> > "delete" part, anyway.
> > 
> > https://github.com/robertmhaas/introduction-to-postgresql-hacking/compare/master...robertmhaas:delete_needs_where
> 
> I'm happy to write the rest of this as a contrib module.  I hope to
> get to that this evening.
I've renamed it to require_where and contrib-ified.
Best,
David.
-- 
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david(dot)fetter(at)gmail(dot)com
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
| Attachment | Content-Type | Size | 
|---|---|---|
| training_wheels_002.patch | text/plain | 6.9 KB | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2016-07-22 06:43:30 | Re: Password identifiers, protocol aging and SCRAM protocol | 
| Previous Message | Kyotaro HORIGUCHI | 2016-07-22 05:59:31 | Re: [BUG] pg_basebackup from disconnected standby fails |