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

From: Abhijit Menon-Sen <ams(at)2ndQuadrant(dot)com>
To: Karol Trzcionka <karlikt(at)gmail(dot)com>
Cc: fabrizio(at)timbira(dot)com(dot)br, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements
Date: 2013-07-27 02:31:32
Message-ID: 20130727023132.GA8383@toroid.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At 2013-07-26 10:39:00 +0200, karlikt(at)gmail(dot)com wrote:
>
> Hello, as I can see there are more inconsistent places.

Right. This is what I was referring to in my original review. All of the
relevant sites (pre-patch) that currently do:

if (already exists)
ereport(ERROR …)

should instead be made to do:

if (already exists)
{
if (ifNotExists)
{
ereport(NOTICE …)
return
}

ereport(ERROR …)
}

or even (very slightly easier to review):

if (already exists && ifNotExists)
{
ereport(ERROR …)
return
}

if (already exists)
ereport(ERROR …)

I don't care much which of the two is used, so long as it's (a) the same
everywhere, and (b) there's no "if (!ifNot" anywhere.

-- Abhijit

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Abhijit Menon-Sen 2013-07-27 02:57:39 Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements
Previous Message Lonni J Friedman 2013-07-26 22:44:54 Re: [GENERAL] postgres FDW cost estimation options unrecognized in 9.3-beta1