Re: [HACKERS] alter enum add value if not exists

2012-09-26 Thread Bruce Momjian
On Sat, Sep 22, 2012 at 06:08:19PM -0400, Tom Lane wrote: > Hannu Krosing writes: > > On 09/22/2012 11:49 PM, Andrew Dunstan wrote: > >> Not really, I guess we should for the sake of consistency, although TBH > >> I find it just useless noise and rather wish we hadn't started the > >> trend when

Re: [HACKERS] alter enum add value if not exists

2012-09-22 Thread Andrew Dunstan
On 09/22/2012 07:05 PM, Tom Lane wrote: I wrote: ... It strikes me though that if we're going to invent an opt_if_not_exists production in the grammar, there are a lot of other places where it should be used too, for consistency if nothing else. BTW, I tried to do this and realized that it do

Re: [HACKERS] alter enum add value if not exists

2012-09-22 Thread Tom Lane
I wrote: > ... It strikes me though that if > we're going to invent an opt_if_not_exists production in the grammar, > there are a lot of other places where it should be used too, for > consistency if nothing else. BTW, I tried to do this and realized that it doesn't work, because IF is not a rese

Re: [HACKERS] alter enum add value if not exists

2012-09-22 Thread Tom Lane
Hannu Krosing writes: > On 09/22/2012 11:49 PM, Andrew Dunstan wrote: >> Not really, I guess we should for the sake of consistency, although TBH >> I find it just useless noise and rather wish we hadn't started the >> trend when we did the first DROP IF NOT EXISTS stuff. > Time for a GUC > exist

Re: [HACKERS] alter enum add value if not exists

2012-09-22 Thread Tom Lane
Andrew Dunstan writes: > On 09/22/2012 05:39 PM, Tom Lane wrote: >> BTW, looking at that a second time ... the other CREATE IF NOT EXISTS >> options we have issue a NOTICE when skipping the CREATE action. Is >> there a reason this shouldn't do the same? > I'll add it. I'm on it already.

Re: [HACKERS] alter enum add value if not exists

2012-09-22 Thread Hannu Krosing
On 09/22/2012 11:49 PM, Andrew Dunstan wrote: On 09/22/2012 05:39 PM, Tom Lane wrote: Andrew Dunstan writes: The enum piece is now committed. BTW, looking at that a second time ... the other CREATE IF NOT EXISTS options we have issue a NOTICE when skipping the CREATE action. Is there a reaso

Re: [HACKERS] alter enum add value if not exists

2012-09-22 Thread Andrew Dunstan
On 09/22/2012 05:39 PM, Tom Lane wrote: Andrew Dunstan writes: The enum piece is now committed. BTW, looking at that a second time ... the other CREATE IF NOT EXISTS options we have issue a NOTICE when skipping the CREATE action. Is there a reason this shouldn't do the same?

Re: [HACKERS] alter enum add value if not exists

2012-09-22 Thread Tom Lane
Andrew Dunstan writes: > The enum piece is now committed. BTW, looking at that a second time ... the other CREATE IF NOT EXISTS options we have issue a NOTICE when skipping the CREATE action. Is there a reason this shouldn't do the same? regards, tom lane -- Sent via

Re: [HACKERS] alter enum add value if not exists

2012-09-22 Thread Andrew Dunstan
On 09/20/2012 06:34 PM, Tom Lane wrote: Andrew Dunstan writes: On 08/23/2012 07:39 AM, Magnus Hagander wrote: It doesn't break, of course ,since it's protected by the unique index. But aren't you at risk of getting the very error message you're trying to avoid? Yeah, looking further this was

Re: [HACKERS] alter enum add value if not exists

2012-09-20 Thread Tom Lane
Andrew Dunstan writes: > On 08/23/2012 07:39 AM, Magnus Hagander wrote: >> It doesn't break, of course ,since it's protected by the unique index. >> But aren't you at risk of getting the very error message you're trying >> to avoid? > Yeah, looking further this was probably a thinko on my part. T

Re: [HACKERS] alter enum add value if not exists

2012-08-23 Thread Andrew Dunstan
On 08/23/2012 07:39 AM, Magnus Hagander wrote: On Thu, Aug 23, 2012 at 1:35 PM, Andrew Dunstan wrote: On 08/23/2012 06:47 AM, Magnus Hagander wrote: On Mon, Aug 20, 2012 at 4:52 PM, Andrew Dunstan wrote: Here is a patch for this feature, which should alleviate some of the woes caused by add

Re: [HACKERS] alter enum add value if not exists

2012-08-23 Thread Magnus Hagander
On Thu, Aug 23, 2012 at 1:35 PM, Andrew Dunstan wrote: > > On 08/23/2012 06:47 AM, Magnus Hagander wrote: >> >> On Mon, Aug 20, 2012 at 4:52 PM, Andrew Dunstan >> wrote: >>> >>> Here is a patch for this feature, which should alleviate some of the woes >>> caused by adding labels not being transac

Re: [HACKERS] alter enum add value if not exists

2012-08-23 Thread Andrew Dunstan
On 08/23/2012 06:47 AM, Magnus Hagander wrote: On Mon, Aug 20, 2012 at 4:52 PM, Andrew Dunstan wrote: Here is a patch for this feature, which should alleviate some of the woes caused by adding labels not being transactional (and thus not allowing for the catching of errors). I haven't actuall

Re: [HACKERS] alter enum add value if not exists

2012-08-23 Thread Magnus Hagander
On Mon, Aug 20, 2012 at 4:52 PM, Andrew Dunstan wrote: > Here is a patch for this feature, which should alleviate some of the woes > caused by adding labels not being transactional (and thus not allowing for > the catching of errors). I haven't actually checked the code in detail, but if it's not