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: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements
Date: 2013-06-29 13:53:14
Message-ID: CAFcNs+qZKeK+MT+ftTpFFbD3mxFVLKvXEXZuKothoFBb6oGyLQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 20, 2013 at 1:24 PM, Peter Eisentraut <peter_e(at)gmx(dot)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 possible.
>
> I tend to agree.

I agree if is possible to have OR REPLACE then we must do that, but in
other hands
I don't see a problem if we have support to both IF NOT EXISTS and OR
REPLACE. In
some cases we don't really want to replace the object body if its already
exists so
IF NOT EXISTS is useful to don't break the transaction inside a upgrade
script.

> >> > Btw., I also want REPLACE BUT DO NOT CREATE.
> > That's a mouthful. What's it good for?
>
> If you run an upgrade SQL script that is supposed to replace, say, a
> bunch of functions with new versions, you'd want the behavior that it
> replaces the existing function if it exists, but errors out if it
> doesn't, because then you're perhaps connected to the wrong database.
>
> It's a marginal feature, and I'm not going to pursue it, but if someone
> wanted to make the CREATE commands fully featured, there is use for this.
>

Well, my intention is do that for all CREATE commands.

Regards,

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Blog sobre TI: http://fabriziomello.blogspot.com
>> Perfil Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabrízio de Royes Mello 2013-06-29 14:05:38 Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements
Previous Message Robins 2013-06-29 13:51:42 Re: [PATCH] Add session_preload_libraries configuration parameter