Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements

From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Stephen Frost <sfrost(at)snowman(dot)net>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, "[pgdg] Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
Subject: Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements
Date: 2014-08-26 13:25:50
Message-ID: CAFcNs+rDg6pLRP0gc-BNb2h3z_KJYC06B848rjf8Qoz-An1B=Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Aug 26, 2014 at 10:20 AM, Heikki Linnakangas <
hlinnakangas(at)vmware(dot)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 <robertmhaas(at)gmail(dot)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 COR harder to
>>>>
>>> define
>>
>>> --- that's part of the reason why we have CINE not COR for tables, and
>>>> maybe we have to do the same for sequences. The point being exactly
>>>> that if you use CINE, you're implicitly accepting that you don't know
>>>> the ensuing state fully.
>>>>
>>>
>>> Yeah. I think CINE is more sensible than COR for sequences, for
>>> precisely the reason that they do have contained data (even if it's
>>> basically only one value).
>>>
>>>
>> The attached patch contains CINE for sequences.
>>
>> I just strip this code from the patch rejected before.
>>
>
> Committed with minor changes:
>
> * The documentation promised too much. It said that it would not throw an
> error "if a sequence with the same name exists". In fact, it will not throw
> an error if any relation with the same name exists. I rewrote that
> paragraph to emphasize that more, re-using the phrases from the CREATE
> TABLE manual page.
>
> * don't call RangeVarGetAndCheckCreationNamespace unnecessarily when IF
> NOT EXISTS is not used.
>
>
Thanks!

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog: http://fabriziomello.github.io
>> Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
>> Github: http://github.com/fabriziomello

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2014-08-26 13:28:19 Re: a7ae1dc has broken the windows builds
Previous Message Andres Freund 2014-08-26 13:23:20 Re: add line number as prompt option to psql