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

2017-03-16 Thread Robert Haas
On Thu, Feb 2, 2017 at 12:24 PM, David Fetter wrote: >> 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

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

2017-02-04 Thread Michael Paquier
On Sun, Feb 5, 2017 at 10:08 AM, Rod Taylor wrote: > A general SQL-Critic would be a very welcome extension. Please no hyphen for extension names! -- Michael -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription:

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

2017-02-04 Thread Rod Taylor
On Thu, Feb 2, 2017 at 11:40 AM, Alvaro Herrera wrote: > Pavel Stehule wrote: > > > Identification of unjoined tables should be very useful - but it is far > to > > original proposal - so it can be solved separately. > > > > This patch is simple - and usually we prefer

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

2017-02-02 Thread Nico Williams
On Thu, Feb 02, 2017 at 12:14:10PM -0500, Tom Lane wrote: > 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. WHERE-less-ness should be

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

2017-02-02 Thread David Fetter
On Thu, Feb 02, 2017 at 12:14:10PM -0500, Tom Lane wrote: > Alvaro Herrera 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

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

2017-02-02 Thread Tom Lane
Alvaro Herrera 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

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

2017-02-02 Thread Alvaro Herrera
Pavel Stehule wrote: > Identification of unjoined tables should be very useful - but it is far to > original proposal - so it can be solved separately. > > This patch is simple - and usually we prefer more simple patches than one > bigger. > > Better to enhance this feature step by step.

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

2017-02-02 Thread Pavel Stehule
2017-02-02 16:34 GMT+01:00 Bruce Momjian : > On Thu, Feb 2, 2017 at 07:18:45AM -0800, David Fetter wrote: > > On Thu, Feb 02, 2017 at 03:16:29PM +, Bruce Momjian wrote: > > > I just don't see this patch going in. I think it needs are larger > > > approach to the problems

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

2017-02-02 Thread David Fetter
On Thu, Feb 02, 2017 at 10:34:43AM -0500, Bruce Momjian wrote: > On Thu, Feb 2, 2017 at 07:18:45AM -0800, David Fetter wrote: > > On Thu, Feb 02, 2017 at 03:16:29PM +, Bruce Momjian wrote: > > > I just don't see this patch going in. I think it needs are > > > larger approach to the problems

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

2017-02-02 Thread Bruce Momjian
On Thu, Feb 2, 2017 at 07:18:45AM -0800, David Fetter wrote: > On Thu, Feb 02, 2017 at 03:16:29PM +, Bruce Momjian wrote: > > I just don't see this patch going in. I think it needs are larger > > approach to the problems it is trying to solve. I think it then > > will be very useful. > >

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

2017-02-02 Thread Bruce Momjian
I just don't see this patch going in. I think it needs are larger approach to the problems it is trying to solve. I think it then will be very useful. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription:

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

2017-02-02 Thread David Fetter
On Thu, Feb 02, 2017 at 03:16:29PM +, Bruce Momjian wrote: > I just don't see this patch going in. I think it needs are larger > approach to the problems it is trying to solve. I think it then > will be very useful. What problems that it's trying to solve are not addressed? Best, David. --

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

2017-01-31 Thread Michael Paquier
On Wed, Jan 11, 2017 at 11:55 PM, Pavel Stehule wrote: > I'll mark this patch as ready for commiter Moved to CF 2017-03. -- Michael -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription:

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

2017-01-11 Thread Pavel Stehule
Hi 2017-01-10 17:31 GMT+01:00 David Fetter : > On Mon, Jan 09, 2017 at 07:52:11PM -0300, Alvaro Herrera wrote: > > David Fetter wrote: > > > > > + if (query->commandType == CMD_UPDATE || query->commandType == > CMD_DELETE) > > > + { > > > + /* Make sure there's

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

2017-01-10 Thread David Fetter
On Tue, Jan 10, 2017 at 08:31:47AM -0800, David Fetter wrote: > On Mon, Jan 09, 2017 at 07:52:11PM -0300, Alvaro Herrera wrote: > > David Fetter wrote: > > > > > + if (query->commandType == CMD_UPDATE || query->commandType == > > > CMD_DELETE) > > > + { > > > + /* Make sure there's

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

2017-01-10 Thread David Fetter
On Mon, Jan 09, 2017 at 07:52:11PM -0300, Alvaro Herrera wrote: > David Fetter wrote: > > > + if (query->commandType == CMD_UPDATE || query->commandType == > > CMD_DELETE) > > + { > > + /* Make sure there's something to look at. */ > > + Assert(query->jointree != NULL); >

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

2017-01-09 Thread David Fetter
On Mon, Jan 09, 2017 at 07:52:11PM -0300, Alvaro Herrera wrote: > David Fetter wrote: > > > + if (query->commandType == CMD_UPDATE || query->commandType == > > CMD_DELETE) > > + { > > + /* Make sure there's something to look at. */ > > + Assert(query->jointree != NULL); >

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

2017-01-09 Thread Alvaro Herrera
David Fetter wrote: > + if (query->commandType == CMD_UPDATE || query->commandType == > CMD_DELETE) > + { > + /* Make sure there's something to look at. */ > + Assert(query->jointree != NULL); > + if (query->jointree->quals == NULL) > +

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

2017-01-09 Thread David Fetter
On Sun, Jan 08, 2017 at 06:50:12PM -0600, Jim Nasby wrote: > On 1/5/17 12:04 AM, David Fetter wrote: > > +errmsg("UPDATE requires a WHERE clause > > when require_where.delete is set to on"), > > ISTM that message is no longer true. > > The second if could

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

2017-01-08 Thread Jim Nasby
On 1/5/17 12:04 AM, David Fetter wrote: +errmsg("UPDATE requires a WHERE clause when require_where.delete is set to on"), ISTM that message is no longer true. The second if could also be an else if too. -- Jim Nasby, Data Architect, Blue Treble

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

2017-01-04 Thread David Fetter
On Wed, Jan 04, 2017 at 09:58:26PM -0800, David Fetter wrote: > On Sun, Jan 01, 2017 at 07:57:33PM +0900, Michael Paquier wrote: > > On Sun, Jan 1, 2017 at 12:34 PM, David Fetter wrote: > > > I've rolled your patches into this next one and clarified the commit > > > message, as

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

2017-01-04 Thread David Fetter
On Sun, Jan 01, 2017 at 07:57:33PM +0900, Michael Paquier wrote: > On Sun, Jan 1, 2017 at 12:34 PM, David Fetter wrote: > > I've rolled your patches into this next one and clarified the commit > > message, as there appears to have been some confusion about the scope. > > Is

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

2017-01-03 Thread David Fetter
On Tue, Jan 03, 2017 at 11:59:19AM +0100, Pavel Stehule wrote: > Hi > I am sending review of this patch > > 1. there are not any problem with patching, compiling, doc > 2. the patch is simple, the documentation is good enough > 3. all regress tests passed without problems > > My questions: > >

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

2017-01-03 Thread David Fetter
On Sun, Jan 01, 2017 at 07:57:33PM +0900, Michael Paquier wrote: > On Sun, Jan 1, 2017 at 12:34 PM, David Fetter wrote: > > I've rolled your patches into this next one and clarified the commit > > message, as there appears to have been some confusion about the scope. > > Not

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

2017-01-03 Thread Pavel Stehule
Hi 2016-07-21 6:57 GMT+02:00 David Fetter : > 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? > > Thanks to Gurjeet

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

2017-01-01 Thread Michael Paquier
On Sun, Jan 1, 2017 at 12:34 PM, David Fetter wrote: > I've rolled your patches into this next one and clarified the commit > message, as there appears to have been some confusion about the scope. Not all the comments have been considered! Here are some example.. =# set

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

2016-12-31 Thread David Fetter
On Fri, Sep 30, 2016 at 04:23:13PM +1300, Thomas Munro wrote: > On Thu, Sep 29, 2016 at 6:19 PM, David Fetter wrote: > > On Thu, Sep 29, 2016 at 11:12:11AM +1300, Thomas Munro wrote: > >> On Mon, Sep 26, 2016 at 5:11 PM, Thomas Munro > >> wrote: >

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

2016-10-01 Thread Michael Paquier
On Sat, Oct 1, 2016 at 5:08 AM, Thomas Munro 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

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

2016-10-01 Thread Michael Paquier
On Sat, Oct 1, 2016 at 5:08 AM, Thomas Munro wrote: > Right. These cases work because they show up as CMD_DELETE/CMD_UPDATE: > > postgres=# set require_where.delete = on; > SET > postgres=# with answer as (select 42) delete from foo; > ERROR: DELETE requires a

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

2016-09-30 Thread Thomas Munro
On Sat, Oct 1, 2016 at 8:32 AM, Julien Rouhaud wrote: > On 30/09/2016 21:12, David Fetter wrote: >> On Fri, Sep 30, 2016 at 06:37:17PM +0200, Julien Rouhaud wrote: >>> On 30/09/2016 05:23, Thomas Munro wrote: It would be really nice to be able to set this to

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

2016-09-30 Thread Peter Eisentraut
On 9/29/16 11:23 PM, Thomas Munro wrote: > The regression test fails. The expected error messages show the old > wording, so I think you forgot to add a file. Also, should > contrib/require_where/Makefile define REGRESS = require_where? That > would allow 'make check' from inside that

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

2016-09-30 Thread Julien Rouhaud
On 30/09/2016 21:12, David Fetter wrote: > On Fri, Sep 30, 2016 at 06:37:17PM +0200, Julien Rouhaud wrote: >> On 30/09/2016 05:23, Thomas Munro wrote: >>> >>> It would be really nice to be able to set this to 'Ready for >>> Committer' in this CF. Do you want to post a v6 patch or are you >>>

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

2016-09-30 Thread David Fetter
On Fri, Sep 30, 2016 at 06:37:17PM +0200, Julien Rouhaud wrote: > On 30/09/2016 05:23, Thomas Munro wrote: > > > > It would be really nice to be able to set this to 'Ready for > > Committer' in this CF. Do you want to post a v6 patch or are you > > happy for me to ask a committer to look at v5 +

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

2016-09-30 Thread Alvaro Herrera
Thomas Munro wrote: > On Thu, Sep 29, 2016 at 6:19 PM, David Fetter wrote: > > Please find attached the next revision. > > I'm not sold on ERRCODE_SYNTAX_ERROR. There's nothing wrong with the > syntax, since parsing succeeded. It would be cool if we could use >

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

2016-09-30 Thread Julien Rouhaud
On 30/09/2016 05:23, Thomas Munro wrote: > > It would be really nice to be able to set this to 'Ready for > Committer' in this CF. Do you want to post a v6 patch or are you > happy for me to ask a committer to look at v5 + these three > corrections? I just looked at the patch, and noticed that

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

2016-09-29 Thread Thomas Munro
On Thu, Sep 29, 2016 at 6:19 PM, David Fetter wrote: > On Thu, Sep 29, 2016 at 11:12:11AM +1300, Thomas Munro wrote: >> On Mon, Sep 26, 2016 at 5:11 PM, Thomas Munro >> wrote: >> > On Mon, Sep 26, 2016 at 1:18 PM, Thomas Munro >> >

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

2016-09-28 Thread David Fetter
On Thu, Sep 29, 2016 at 11:12:11AM +1300, Thomas Munro wrote: > On Mon, Sep 26, 2016 at 5:11 PM, Thomas Munro > wrote: > > On Mon, Sep 26, 2016 at 1:18 PM, Thomas Munro > > wrote: > >> > >> On Mon, Sep 19, 2016 at 4:02 PM, David

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

2016-09-28 Thread David Fetter
On Thu, Sep 29, 2016 at 11:12:11AM +1300, Thomas Munro wrote: > On Mon, Sep 26, 2016 at 5:11 PM, Thomas Munro > wrote: > > On Mon, Sep 26, 2016 at 1:18 PM, Thomas Munro > > wrote: > >> > >> On Mon, Sep 19, 2016 at 4:02 PM, David

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

2016-09-28 Thread Thomas Munro
On Mon, Sep 26, 2016 at 5:11 PM, Thomas Munro wrote: > On Mon, Sep 26, 2016 at 1:18 PM, Thomas Munro > wrote: >> >> On Mon, Sep 19, 2016 at 4:02 PM, David Fetter wrote: >> > >> > [training_wheels_004.patch] >> >>

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

2016-09-25 Thread Thomas Munro
On Mon, Sep 26, 2016 at 5:11 PM, Thomas Munro wrote: > It seems that the version of docbook that you get if you follow the > instructions[1] ... > And I mean these instructions: [1] https://www.postgresql.org/docs/devel/static/docguide-toolsets.html -- Thomas

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

2016-09-25 Thread Thomas Munro
On Mon, Sep 26, 2016 at 1:18 PM, Thomas Munro wrote: > On Mon, Sep 19, 2016 at 4:02 PM, David Fetter wrote: > > > > [training_wheels_004.patch] > > openjade:filelist.sgml:144:16:E: character "_" invalid: only parameter > literal, "CDATA",

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

2016-09-25 Thread Rushabh Lathia
On Mon, Sep 26, 2016 at 5:48 AM, Thomas Munro wrote: > On Mon, Sep 19, 2016 at 4:02 PM, David Fetter wrote: > > > > [training_wheels_004.patch] > > openjade:filelist.sgml:144:16:E: character "_" invalid: only parameter > literal, "CDATA",

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

2016-09-25 Thread Thomas Munro
On Mon, Sep 26, 2016 at 1:18 PM, Thomas Munro wrote: > underscore to a minus in various places. That fixes these errors: Correction: s/these errors:/the above errors./ -- Thomas Munro http://www.enterprisedb.com -- Sent via pgsql-hackers mailing list

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

2016-09-25 Thread Thomas Munro
On Mon, Sep 19, 2016 at 4:02 PM, David Fetter wrote: > > [training_wheels_004.patch] openjade:filelist.sgml:144:16:E: character "_" invalid: only parameter literal, "CDATA", "ENDTAG", "MD", "MS", "PI", "PUBLIC", "SDATA", "STARTTAG", "SYSTEM" and parameter separators allowed

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

2016-09-20 Thread Peter Eisentraut
On 9/20/16 3:04 PM, David Fetter wrote: > On Fri, Sep 09, 2016 at 09:57:21AM -0400, Peter Eisentraut wrote: >> Review of the patch in the commit fest: >> >> - The documentation is a bit incorrect about the ways to load this >> module. shared_preload_libraries is not necessary. session_ and >>

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

2016-09-20 Thread David Fetter
On Fri, Sep 09, 2016 at 09:57:21AM -0400, Peter Eisentraut wrote: > Review of the patch in the commit fest: > > - The documentation is a bit incorrect about the ways to load this > module. shared_preload_libraries is not necessary. session_ and > local_ (with prep) should also work. Would

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

2016-09-19 Thread David Fetter
On Mon, Sep 19, 2016 at 03:00:51PM -0400, Peter Eisentraut wrote: > On 9/19/16 12:02 AM, David Fetter wrote: > >> - The claim in the documentation that only superusers can do things > >> > with this module is not generally correct. > > I think that the claims are fixed. This is SUSET, at least

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

2016-09-19 Thread Peter Eisentraut
On 9/19/16 12:02 AM, David Fetter wrote: >> - The claim in the documentation that only superusers can do things >> > with this module is not generally correct. > I think that the claims are fixed. This is SUSET, at least in this > patch, because anything short of that that changes query

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

2016-09-19 Thread Robert Haas
On Mon, Sep 19, 2016 at 12:02 AM, David Fetter wrote: >> - The claim in the documentation that only superusers can do things >> with this module is not generally correct. > > I think that the claims are fixed. This is SUSET, at least in this > patch, because anything short of

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

2016-09-18 Thread David Fetter
On Fri, Sep 09, 2016 at 09:57:21AM -0400, Peter Eisentraut wrote: > Review of the patch in the commit fest: > > - Various naming/spelling inconsistencies: In the source, the module > is require_where, the documentation titles it require-where, the GUC > parameters are requires_where.*, but

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

2016-09-10 Thread Jim Nasby
On 8/1/16 11:38 AM, Bruce Momjian wrote: I am hoping for a "novice" mode that issues warnings about possible bugs, e.g. unintentionally-correlated subselect, and this could be part of that. Somewhat related; I've recently been wondering about a mode that disallows Const's in queries coming

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

2016-09-09 Thread Peter Eisentraut
Review of the patch in the commit fest: - Various naming/spelling inconsistencies: In the source, the module is require_where, the documentation titles it require-where, the GUC parameters are requires_where.*, but incorrectly documented. - Unusual indentation in the Makefile - Needs tests

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

2016-08-01 Thread Bruce Momjian
On Thu, Jul 21, 2016 at 09:49:33AM -0400, Tom Lane wrote: > David Fetter writes: > > 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. > > >

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

2016-07-28 Thread David Fetter
On Wed, Jul 27, 2016 at 02:59:17PM +0200, Vik Fearing wrote: > On 27/07/16 06:11, David Fetter wrote: > > On Wed, Jul 27, 2016 at 03:24:28AM +0200, Vik Fearing wrote: > >> On 27/07/16 03:15, Peter Eisentraut wrote: > >>> On 7/26/16 6:14 PM, Vik Fearing wrote: > As mentioned elsewhere in the

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

2016-07-27 Thread Peter van Hardenberg
On Tue, Jul 26, 2016 at 6:15 PM, Peter Eisentraut < peter.eisentr...@2ndquadrant.com> wrote: > On 7/26/16 6:14 PM, Vik Fearing wrote: > > As mentioned elsewhere in the thread, you can just do WHERE true to get > > around it, so why on Earth have it PGC_SUSET? > > I'm not sure whether it's

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

2016-07-27 Thread Vik Fearing
On 27/07/16 06:11, David Fetter wrote: > On Wed, Jul 27, 2016 at 03:24:28AM +0200, Vik Fearing wrote: >> On 27/07/16 03:15, Peter Eisentraut wrote: >>> On 7/26/16 6:14 PM, Vik Fearing wrote: As mentioned elsewhere in the thread, you can just do WHERE true to get around it, so why on

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

2016-07-26 Thread David Fetter
On Wed, Jul 27, 2016 at 03:24:28AM +0200, Vik Fearing wrote: > On 27/07/16 03:15, Peter Eisentraut wrote: > > On 7/26/16 6:14 PM, Vik Fearing wrote: > >> As mentioned elsewhere in the thread, you can just do WHERE true > >> to get around it, so why on Earth have it PGC_SUSET? > > > > I'm not sure

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

2016-07-26 Thread Tom Lane
Peter Eisentraut writes: > On 7/26/16 6:14 PM, Vik Fearing wrote: >> As mentioned elsewhere in the thread, you can just do WHERE true to get >> around it, so why on Earth have it PGC_SUSET? > I'm not sure whether it's supposed to guard against typos and possibly

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

2016-07-26 Thread Vik Fearing
On 27/07/16 03:15, Peter Eisentraut wrote: > On 7/26/16 6:14 PM, Vik Fearing wrote: >> As mentioned elsewhere in the thread, you can just do WHERE true to get >> around it, so why on Earth have it PGC_SUSET? > > I'm not sure whether it's supposed to guard against typos and possibly > buggy SQL

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

2016-07-26 Thread Peter Eisentraut
On 7/26/16 6:14 PM, Vik Fearing wrote: > As mentioned elsewhere in the thread, you can just do WHERE true to get > around it, so why on Earth have it PGC_SUSET? I'm not sure whether it's supposed to guard against typos and possibly buggy SQL string concatenation in application code. So it would

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

2016-07-26 Thread David Fetter
On Tue, Jul 26, 2016 at 04:39:14PM -0400, Robert Haas wrote: > On Mon, Jul 25, 2016 at 11:38 PM, David Fetter wrote: > > On Mon, Jul 25, 2016 at 11:12:24PM -0400, Robert Haas wrote: > >> On Fri, Jul 22, 2016 at 2:38 AM, David Fetter wrote: > >> > I've renamed

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

2016-07-26 Thread Vik Fearing
On 21/07/16 06:57, David Fetter 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? I say I don't like this at all. As mentioned

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

2016-07-26 Thread Robert Haas
On Mon, Jul 25, 2016 at 11:38 PM, David Fetter wrote: > On Mon, Jul 25, 2016 at 11:12:24PM -0400, Robert Haas wrote: >> On Fri, Jul 22, 2016 at 2:38 AM, David Fetter wrote: >> > I've renamed it to require_where and contrib-ified. >> >> I'm not sure that the

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

2016-07-25 Thread David Fetter
On Mon, Jul 25, 2016 at 11:12:24PM -0400, Robert Haas wrote: > On Fri, Jul 22, 2016 at 2:38 AM, David Fetter wrote: > > I've renamed it to require_where and contrib-ified. > > I'm not sure that the Authors section is entirely complete. Does this suit? Best, David. -- David

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

2016-07-25 Thread Robert Haas
On Fri, Jul 22, 2016 at 2:38 AM, David Fetter wrote: > I've renamed it to require_where and contrib-ified. I'm not sure that the Authors section is entirely complete. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via

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

2016-07-22 Thread David Fetter
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 wrote: > > > On Thu, Jul 21, 2016 at 06:20:37PM +0300, Teodor Sigaev wrote: > > >> > Please find

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

2016-07-21 Thread David Fetter
On Thu, Jul 21, 2016 at 04:48:37PM -0500, Jim Nasby wrote: > On 7/21/16 11:46 AM, David Fetter wrote: > > > > Can't you implement this as a extension? > > Yes. In that case, I'd want to make it a contrib extension, as it is > > at least in theory attached to specific major versions of the

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

2016-07-21 Thread Jim Nasby
On 7/21/16 11:46 AM, David Fetter wrote: > Can't you implement this as a extension? Yes. In that case, I'd want to make it a contrib extension, as it is at least in theory attached to specific major versions of the backend. Howso? -- Jim Nasby, Data Architect, Blue Treble Consulting, Austin

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

2016-07-21 Thread Robert Haas
On Thu, Jul 21, 2016 at 12:49 PM, Abhijit Menon-Sen wrote: > At 2016-07-21 12:46:29 -0400, robertmh...@gmail.com wrote: >> >> I join with others in thinking it's a reasonable contrib module. > > I don't like the use of the term "empty" to describe an UPDATE or DELETE >

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

2016-07-21 Thread Abhijit Menon-Sen
At 2016-07-21 12:46:29 -0400, robertmh...@gmail.com wrote: > > I join with others in thinking it's a reasonable contrib module. I don't like the use of the term "empty" to describe an UPDATE or DELETE without a WHERE clause. -- Abhijit -- Sent via pgsql-hackers mailing list

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

2016-07-21 Thread David Fetter
On Thu, Jul 21, 2016 at 12:51:50PM -0400, Robert Haas wrote: > On Thu, Jul 21, 2016 at 12:49 PM, Abhijit Menon-Sen > wrote: > > At 2016-07-21 12:46:29 -0400, robertmh...@gmail.com wrote: > >> > >> I join with others in thinking it's a reasonable contrib module. > > > > I

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

2016-07-21 Thread David Fetter
On Thu, Jul 21, 2016 at 12:46:29PM -0400, Robert Haas wrote: > On Thu, Jul 21, 2016 at 12:39 PM, David Fetter 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

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

2016-07-21 Thread David Fetter
On Thu, Jul 21, 2016 at 09:21:55AM -0400, Jim Mlodgenski wrote: > On Thu, Jul 21, 2016 at 12:57 AM, David Fetter 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,

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

2016-07-21 Thread Robert Haas
On Thu, Jul 21, 2016 at 12:39 PM, David Fetter 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,

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

2016-07-21 Thread David Fetter
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

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

2016-07-21 Thread Teodor Sigaev
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; ? -- Teodor Sigaev E-mail:

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

2016-07-21 Thread Joshua D. Drake
On 07/21/2016 06:49 AM, Tom Lane wrote: David Fetter writes: 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? -1 -1. This is

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

2016-07-21 Thread Tom Lane
David Fetter writes: > 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? -1. This is an express violation of the SQL standard, and

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

2016-07-21 Thread Craig Ringer
On 21 July 2016 at 15:49, Amit Kapila wrote: > On Thu, Jul 21, 2016 at 10:27 AM, David Fetter wrote: > > Folks, > > > > Please find attached a patch which makes it possible to disallow > > UPDATEs and DELETEs which lack a WHERE clause. As this changes

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

2016-07-21 Thread Jim Mlodgenski
On Thu, Jul 21, 2016 at 12:57 AM, David Fetter 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? > > Can't you

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

2016-07-21 Thread Amit Kapila
On Thu, Jul 21, 2016 at 10:27 AM, David Fetter 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

[HACKERS] PoC: Make it possible to disallow WHERE-less UPDATE and DELETE

2016-07-20 Thread David Fetter
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? Thanks to Gurjeet Singh for the idea and Andrew Gierth for the tips implementing. Best, David. --