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 ha...@2ndquadrant.com 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

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 and...@dunslane.net 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,

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

2012-09-22 Thread Tom Lane
Andrew Dunstan and...@dunslane.net 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

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 and...@dunslane.net 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

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 and...@dunslane.net 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

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

2012-09-22 Thread Tom Lane
Andrew Dunstan and...@dunslane.net 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

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

2012-09-22 Thread Tom Lane
Hannu Krosing ha...@2ndquadrant.com 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

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

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

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

2012-09-20 Thread Tom Lane
Andrew Dunstan and...@dunslane.net 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

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 and...@dunslane.net 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

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 and...@dunslane.net 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

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 and...@dunslane.net wrote: On 08/23/2012 06:47 AM, Magnus Hagander wrote: On Mon, Aug 20, 2012 at 4:52 PM, Andrew Dunstan and...@dunslane.net wrote: Here is a patch for this feature, which should alleviate some of the woes caused by adding

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 and...@dunslane.net wrote: On 08/23/2012 06:47 AM, Magnus Hagander wrote: On Mon, Aug 20, 2012 at 4:52 PM, Andrew Dunstan and...@dunslane.net wrote: Here is a patch for this feature, which should