Re: PoC: Make it possible to disallow WHERE-less UPDATE and DELETE
Michael Paquier <michael.paquier@gmail.com>
From: Michael Paquier <michael.paquier@gmail.com>
To: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: Julien Rouhaud <julien.rouhaud@dalibo.com>,
David Fetter <david@fetter.org>, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>,
Robert Haas <robertmhaas@gmail.com>, PostgreSQL Development <pgsql-hackers@postgresql.org>
Date: 2016-10-01T12:52:25Z
Lists: 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