Re: PoC: Make it possible to disallow WHERE-less UPDATE and DELETE - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: PoC: Make it possible to disallow WHERE-less UPDATE and DELETE
Date
Msg-id CAB7nPqRDoOZ+a1xO9fmSg9zzHsaww85SONL9zuZQ+XAVNCwANg@mail.gmail.com
Whole thread Raw
In response to Re: PoC: Make it possible to disallow WHERE-less UPDATE and DELETE  (Thomas Munro <thomas.munro@enterprisedb.com>)
List pgsql-hackers
On Sat, Oct 1, 2016 at 5:08 AM, Thomas Munro
<thomas.munro@enterprisedb.com> wrote:
> I guess you need something involving query_tree_walker or some other
> kind of recursive traversal if you want to find DELETE/UPDATE lurking
> in there.
>
> One option would be to document it as working for top level DELETE or
> UPDATE, and leave the recursive version as an improvement for a later
> patch.  That's the most interesting kind to catch because that's what
> people are most likely to type directly into a command line.

That would be a halfy-baked feature then, and the patch would finish
by being refactored anyway if we support more cases in the future,
because those will need a tree walker (think CTAS, INSERT SELECT,
using WITH queries that contain DMLs)... Personally I think that it
would be surprising if subqueries are not restrained. So I am -1 for
the patch as-is, and let's come up with the most generic approach.

Having more regression tests would be a good idea as well. I am
marking the patch as returned with feedback. This CF has normally
already ended.
-- 
Michael



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: COPY command with RLS bug
Next
From: Fabien COELHO
Date:
Subject: Re: pgbench more operators & functions