Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2014-10-02 Thread Marti Raudsepp
On Tue, Aug 26, 2014 at 4:20 PM, Heikki Linnakangas hlinnakan...@vmware.com wrote: On 04/14/2014 10:31 PM, Fabrízio de Royes Mello wrote: The attached patch contains CINE for sequences. I just strip this code from the patch rejected before. Committed with minor changes Hmm, the CommitFest

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2014-10-02 Thread Fabrízio de Royes Mello
On Thu, Oct 2, 2014 at 9:38 PM, Marti Raudsepp ma...@juffo.org wrote: On Tue, Aug 26, 2014 at 4:20 PM, Heikki Linnakangas hlinnakan...@vmware.com wrote: On 04/14/2014 10:31 PM, Fabrízio de Royes Mello wrote: The attached patch contains CINE for sequences. I just strip this code from the

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2014-08-26 Thread Heikki Linnakangas
On 04/14/2014 10:31 PM, Fabrízio de Royes Mello wrote: On Tue, Apr 1, 2014 at 2:46 PM, Robert Haas robertmh...@gmail.com wrote: Where this is a bit more interesting is in the case of sequences, where resetting the sequence to zero may cause further inserts into an existing table to fail.

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2014-08-26 Thread Fabrízio de Royes Mello
On Tue, Aug 26, 2014 at 10:20 AM, Heikki Linnakangas hlinnakan...@vmware.com wrote: On 04/14/2014 10:31 PM, Fabrízio de Royes Mello wrote: On Tue, Apr 1, 2014 at 2:46 PM, Robert Haas robertmh...@gmail.com wrote: Where this is a bit more interesting is in the case of sequences, where

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2014-04-14 Thread Fabrízio de Royes Mello
On Tue, Apr 1, 2014 at 2:46 PM, Robert Haas robertmh...@gmail.com wrote: Where this is a bit more interesting is in the case of sequences, where resetting the sequence to zero may cause further inserts into an existing table to fail. Yeah. Sequences do have contained data, which makes

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2014-04-01 Thread Tom Lane
Stephen Frost sfr...@snowman.net writes: * Michael Paquier (michael.paqu...@gmail.com) wrote: Except if I am missing something, the second query means that it is going to replace the existing user test with a new one, with the settings specified in the 2nd query, all being default values. As

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2014-04-01 Thread Robert Haas
On Tue, Apr 1, 2014 at 10:03 AM, Tom Lane t...@sss.pgh.pa.us wrote: I'm willing to bend that to the extent of saying that COR leaves in place subsidiary properties that you might add *with additional statements* --- for example, foreign keys for a table, or privilege grants for a role. But the

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2014-04-01 Thread Fabrízio de Royes Mello
On Tue, Apr 1, 2014 at 2:46 PM, Robert Haas robertmh...@gmail.com wrote: On Tue, Apr 1, 2014 at 10:03 AM, Tom Lane t...@sss.pgh.pa.us wrote: I'm willing to bend that to the extent of saying that COR leaves in place subsidiary properties that you might add *with additional statements* ---

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2014-03-31 Thread Stephen Frost
* Fabrízio de Royes Mello (fabriziome...@gmail.com) wrote: - CREATE SEQUENCE [ IF NOT EXISTS ] - CREATE DOMAIN [ IF NOT EXISTS ] - CREATE EVENT TRIGGER [ IF NOT EXISTS ] - CREATE ROLE [ IF NOT EXISTS ] Seems that no one reviewed this part or was rejected with others? Why don't those fall

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2014-03-31 Thread Fabrízio de Royes Mello
On Mon, Mar 31, 2014 at 4:52 PM, Stephen Frost sfr...@snowman.net wrote: * Fabrízio de Royes Mello (fabriziome...@gmail.com) wrote: - CREATE SEQUENCE [ IF NOT EXISTS ] - CREATE DOMAIN [ IF NOT EXISTS ] - CREATE EVENT TRIGGER [ IF NOT EXISTS ] - CREATE ROLE [ IF NOT EXISTS ] Seems

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2014-03-31 Thread Stephen Frost
* Fabrízio de Royes Mello (fabriziome...@gmail.com) wrote: On Mon, Mar 31, 2014 at 4:52 PM, Stephen Frost sfr...@snowman.net wrote: * Fabrízio de Royes Mello (fabriziome...@gmail.com) wrote: - CREATE SEQUENCE [ IF NOT EXISTS ] - CREATE DOMAIN [ IF NOT EXISTS ] - CREATE EVENT TRIGGER

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2014-03-31 Thread Fabrízio de Royes Mello
On Mon, Mar 31, 2014 at 5:00 PM, Stephen Frost sfr...@snowman.net wrote: * Fabrízio de Royes Mello (fabriziome...@gmail.com) wrote: On Mon, Mar 31, 2014 at 4:52 PM, Stephen Frost sfr...@snowman.net wrote: * Fabrízio de Royes Mello (fabriziome...@gmail.com) wrote: - CREATE SEQUENCE [

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2014-03-31 Thread Stephen Frost
* Fabrízio de Royes Mello (fabriziome...@gmail.com) wrote: Because they maintain user data? Eh? You mean like the sequence #? Yes, I'd expect 'CREATE OR REPLACE SEQUENCE' to want a minvalue or something on a 'replace' case to ensure that it doesn't roll backwards unless explicitly asked for.

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2014-03-31 Thread Fabrízio de Royes Mello
On Mon, Mar 31, 2014 at 5:46 PM, Stephen Frost sfr...@snowman.net wrote: * Fabrízio de Royes Mello (fabriziome...@gmail.com) wrote: Because they maintain user data? Eh? You mean like the sequence #? Yes, I'd expect 'CREATE OR REPLACE SEQUENCE' to want a minvalue or something on a

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2014-03-31 Thread Michael Paquier
On Tue, Apr 1, 2014 at 7:28 AM, Fabrízio de Royes Mello fabriziome...@gmail.com wrote: Think about the statements below: CREATE ROLE test NOLOGIN; CREATE OR REPLACE ROLE test; If we execute the statements above the result should be the role 'test' can login. Correct? Except if I am missing

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2014-03-31 Thread Stephen Frost
* Michael Paquier (michael.paqu...@gmail.com) wrote: On Tue, Apr 1, 2014 at 7:28 AM, Fabrízio de Royes Mello fabriziome...@gmail.com wrote: Think about the statements below: CREATE ROLE test NOLOGIN; CREATE OR REPLACE ROLE test; If we execute the statements above the result should be

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2014-03-31 Thread Fabrízio de Royes Mello
On Tue, Apr 1, 2014 at 1:14 AM, Michael Paquier michael.paqu...@gmail.com wrote: On Tue, Apr 1, 2014 at 7:28 AM, Fabrízio de Royes Mello fabriziome...@gmail.com wrote: Think about the statements below: CREATE ROLE test NOLOGIN; CREATE OR REPLACE ROLE test; If we execute the

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2014-03-31 Thread Michael Paquier
On Tue, Apr 1, 2014 at 1:34 PM, Stephen Frost sfr...@snowman.net wrote: * Michael Paquier (michael.paqu...@gmail.com) wrote: On Tue, Apr 1, 2014 at 7:28 AM, Fabrízio de Royes Mello fabriziome...@gmail.com wrote: Think about the statements below: CREATE ROLE test NOLOGIN; CREATE OR

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2014-03-26 Thread Fabrízio de Royes Mello
On Sun, Mar 2, 2014 at 1:04 AM, Fabrízio de Royes Mello fabriziome...@gmail.com wrote: On Sat, Mar 1, 2014 at 7:39 PM, Tom Lane t...@sss.pgh.pa.us wrote: =?ISO-8859-1?Q?Fabr=EDzio_de_Royes_Mello?= fabriziome...@gmail.com writes: On Sat, Mar 1, 2014 at 2:11 PM, Tom Lane t...@sss.pgh.pa.us

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2014-03-01 Thread Tom Lane
=?ISO-8859-1?Q?Fabr=EDzio_de_Royes_Mello?= fabriziome...@gmail.com writes: On Sat, Jan 18, 2014 at 11:12 PM, Stephen Frost sfr...@snowman.net wrote: Fabrízio, can you clarify the use-case for things like CREATE AGGREGATE to have IF NOT EXISTS rather than OR REPLACE, or if there is a reason why

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2014-03-01 Thread Tom Lane
=?ISO-8859-1?Q?Fabr=EDzio_de_Royes_Mello?= fabriziome...@gmail.com writes: On Sat, Mar 1, 2014 at 2:11 PM, Tom Lane t...@sss.pgh.pa.us wrote: [ re schema upgrade scenarios ] Why wouldn't COR semantics answer that requirement just as well, if not better? Just because it will replace the

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2014-03-01 Thread Fabrízio de Royes Mello
On Sat, Mar 1, 2014 at 2:11 PM, Tom Lane t...@sss.pgh.pa.us wrote: =?ISO-8859-1?Q?Fabr=EDzio_de_Royes_Mello?= fabriziome...@gmail.com writes: On Sat, Jan 18, 2014 at 11:12 PM, Stephen Frost sfr...@snowman.net wrote: Fabrízio, can you clarify the use-case for things like CREATE AGGREGATE to

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2014-03-01 Thread Fabrízio de Royes Mello
On Sat, Mar 1, 2014 at 7:39 PM, Tom Lane t...@sss.pgh.pa.us wrote: =?ISO-8859-1?Q?Fabr=EDzio_de_Royes_Mello?= fabriziome...@gmail.com writes: On Sat, Mar 1, 2014 at 2:11 PM, Tom Lane t...@sss.pgh.pa.us wrote: [ re schema upgrade scenarios ] Why wouldn't COR semantics answer that

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2014-02-28 Thread Fabrízio de Royes Mello
On Sat, Jan 18, 2014 at 11:12 PM, Stephen Frost sfr...@snowman.net wrote: Fabrízio, can you clarify the use-case for things like CREATE AGGREGATE to have IF NOT EXISTS rather than OR REPLACE, or if there is a reason why both should exist? Complicating our CREATE options is not something we

[HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2013-09-10 Thread Pavel Stehule
I tested this patch and it is not patchable now. Please, can you fix patch? Regards Pavel

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2013-07-26 Thread Karol Trzcionka
W dniu 26.07.2013 02:44, Fabrízio de Royes Mello pisze: Should be... I fix that in attached patch. Hello, as I can see there are more inconsistent places. First style: OperatorCreate --- Second style: ProcedureCreate TypeCreate DefineTSParser DefineType DefineEnum --- Third style: CreateCast

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2013-07-24 Thread Karol Trzcionka
Hello, patch works fine but is there any reason to comparing each ifNotExists in different way? i.e. ProcedureCreate if (!ifNotExists) ... else { ... return } TypeCreate if (ifNotExists) { ... return } ... --- Shouldn't it be more consistent? Regards, Karol -- Sent via pgsql-hackers

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2013-07-14 Thread Martijn van Oosterhout
On Sun, Jul 14, 2013 at 03:36:09AM -0300, Fabrízio de Royes Mello wrote: Next, changes in src/backend, starting with parser changes: the patch adds IF_P NOT EXISTS variants for various productions. For example: snip I think opt_if_not_exists should be used for the others as well. I

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2013-06-29 Thread Fabrízio de Royes Mello
On Thu, Jun 20, 2013 at 1:24 PM, Peter Eisentraut pete...@gmx.net wrote: On 6/20/13 11:04 AM, Robert Haas wrote: I kind of don't see the point of having IF NOT EXISTS for things that have OR REPLACE, and am generally in favor of implementing OR REPLACE rather than IF NOT EXISTS where

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2013-06-29 Thread Fabrízio de Royes Mello
On Mon, Jun 24, 2013 at 8:05 AM, Andres Freund and...@2ndquadrant.com wrote: I'd argue if we go that way - which seems to be a good idea - we really ought to make a complete pass and add it to all commands where it's currently missing. Yeah... this is my purpose, but I decide do that in two

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2013-06-24 Thread Andres Freund
On 2013-06-12 14:29:59 -0300, Fabrízio de Royes Mello wrote: On Fri, May 24, 2013 at 12:22 PM, Fabrízio de Royes Mello fabriziome...@gmail.com wrote: Hi all, I working in a patch to include support of IF NOT EXISTS into CREATE statements that not have it yet. I started with

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2013-06-20 Thread Fabrízio de Royes Mello
On Thu, Jun 20, 2013 at 1:52 AM, Amit Langote amitlangot...@gmail.com wrote: Is it possible to: CREATE [ OR REPLACE | IF NOT EXISTS ] OPERATOR CLASS I am in a situation where I need to conditionally create an operator class (that is, create only if already does not exist). [...] The

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2013-06-20 Thread Amit Langote
On Thu, Jun 20, 2013 at 9:48 PM, Fabrízio de Royes Mello fabriziome...@gmail.com wrote: On Thu, Jun 20, 2013 at 1:52 AM, Amit Langote amitlangot...@gmail.com wrote: Is it possible to: CREATE [ OR REPLACE | IF NOT EXISTS ] OPERATOR CLASS I am in a situation where I need to conditionally

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2013-06-20 Thread Robert Haas
On Wed, Jun 12, 2013 at 3:00 PM, Peter Eisentraut pete...@gmx.net wrote: On 6/12/13 1:29 PM, Fabrízio de Royes Mello wrote: The attached patch add support to IF NOT EXISTS to CREATE statements listed below: - CREATE AGGREGATE [ IF NOT EXISTS ] ... - CREATE CAST [ IF NOT EXISTS ] ... -

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2013-06-20 Thread Peter Eisentraut
On 6/20/13 11:04 AM, Robert Haas wrote: I kind of don't see the point of having IF NOT EXISTS for things that have OR REPLACE, and am generally in favor of implementing OR REPLACE rather than IF NOT EXISTS where possible. I tend to agree. Btw., I also want REPLACE BUT DO NOT CREATE. That's

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2013-06-19 Thread Amit Langote
On Wed, Jun 19, 2013 at 12:45 PM, Fabrízio de Royes Mello fabriziome...@gmail.com wrote: On Mon, Jun 17, 2013 at 11:33 PM, Peter Eisentraut pete...@gmx.net wrote: Replace/alter the object if it already exists, but fail if it does not exist. The complete set of variants is: - object does

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2013-06-18 Thread Fabrízio de Royes Mello
On Mon, Jun 17, 2013 at 12:36 AM, Robins Tharakan thara...@gmail.comwrote: Hi, Did some basic checks on this patch. List-wise feedback below. [...] Dear Robins, Thanks for your review. I attach your considerations to Commit Fest [1]. Regards, [1]

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2013-06-18 Thread Fabrízio de Royes Mello
On Mon, Jun 17, 2013 at 11:33 PM, Peter Eisentraut pete...@gmx.net wrote: Replace/alter the object if it already exists, but fail if it does not exist. The complete set of variants is: - object does not exist: - proceed (normal CREATE) - error (my above description) - object

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2013-06-17 Thread Peter Eisentraut
On Wed, 2013-06-12 at 16:31 -0300, Fabrízio de Royes Mello wrote: Btw., I also want REPLACE BUT DO NOT CREATE. Can you explain more about it? Replace/alter the object if it already exists, but fail if it does not exist. The complete set of variants is: - object does not exist: -

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2013-06-16 Thread Robins Tharakan
Hi, Did some basic checks on this patch. List-wise feedback below. - Removed unnecessary extra-lines: Yes - Cleanly applies to Git-Head: Yes - Documentation Updated: Yes - Tests Updated: Yes - All tests pass: Yes. (But see Note below) - Does it Work (CREATE AGGREGATE): Yes - Does it Work (CREATE

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2013-06-12 Thread Peter Eisentraut
On 6/12/13 1:29 PM, Fabrízio de Royes Mello wrote: The attached patch add support to IF NOT EXISTS to CREATE statements listed below: - CREATE AGGREGATE [ IF NOT EXISTS ] ... - CREATE CAST [ IF NOT EXISTS ] ... - CREATE COLLATION [ IF NOT EXISTS ] ... - CREATE OPERATOR [ IF NOT EXISTS ]

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2013-06-12 Thread Fabrízio de Royes Mello
On Wed, Jun 12, 2013 at 4:00 PM, Peter Eisentraut pete...@gmx.net wrote: I'm wondering where IF NOT EXISTS and OR REPLACE will meet. For example, why doesn't your list include CREATE FUNCTION? I have on my personal todo list to add OR REPLACE support to CREATE AGGREGATE and CREATE

Re: [HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2013-06-12 Thread Tom Dunstan
On 13 June 2013 04:30, Peter Eisentraut pete...@gmx.net wrote: I'm wondering where IF NOT EXISTS and OR REPLACE will meet. CREATE OR REPLACE (or ALTER / UPDATE ?) would definitely be useful for enums, where it would be nice if we could teach an ORM to generate DDL based on the current values

[HACKERS] Patch to add support of IF NOT EXISTS to others CREATE statements

2013-05-24 Thread Fabrízio de Royes Mello
Hi all, I working in a patch to include support of IF NOT EXISTS into CREATE statements that not have it yet. I started with DefineStmt section from src/backend/parser/gram.y: - CREATE AGGREGATE [ IF NOT EXISTS ] ... - CREATE OPERATOR [ IF NOT EXISTS ] ... - CREATE TYPE [ IF NOT EXISTS ] ... [AS