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

From: David Fetter <david(at)fetter(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PoC: Make it possible to disallow WHERE-less UPDATE and DELETE
Date: 2017-02-02 17:24:51
Message-ID: 20170202172451.GC3541@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Feb 02, 2017 at 12:14:10PM -0500, Tom Lane wrote:
> Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> > Pavel Stehule wrote:
> >> Better to enhance this feature step by step.
>
> > Agreed -- IMO this is a reasonable first step, except that I would
> > rename the proposed extension so that it doesn't focus solely on
> > the first step.
>
> Quite. The patch fails to make up its mind whether it's a trivial
> example meant as a coding demonstration, or something that's going
> to become actually useful.
>
> In the category of "actually useful", I would put checks like "are
> there unqualified outer references in subqueries". That's something
> we see complaints about at least once a month, I think, and it's the
> type of error that even seasoned SQL authors can make easily. But
> the current patch is not extensible in that direction (checking for
> this in post_parse_analyze_hook seems quite impractical).
>
> Also, somebody who wants a check like that isn't necessarily going
> to want "no WHERE clause" training wheels. So you're going to need
> to think about facilities to enable or disable different checks.

This is just the discussion I'd hoped for. I'll draft up a patch in
the next day or two, reflecting what's gone so far.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Moser 2017-02-02 17:43:46 Re: [PROPOSAL] Temporal query processing with range types
Previous Message Tom Lane 2017-02-02 17:14:10 Re: PoC: Make it possible to disallow WHERE-less UPDATE and DELETE