Re: alter enum add value if not exists

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: alter enum add value if not exists
Date: 2012-08-23 11:35:08
Message-ID: 5036156C.1000005@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 08/23/2012 06:47 AM, Magnus Hagander wrote:
> On Mon, Aug 20, 2012 at 4:52 PM, Andrew Dunstan <andrew(at)dunslane(dot)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 detail, but if it's not
> transactional, how does it actually prevent race conditions? Doesn't
> it at least have to do it's check *after* the enum is locked?

Well, you can't remove a label, and if the test succeeds it results in
your doing nothing, so my possibly naive thinking was that that wasn't
necessary. But I could easily be wrong :-)

>
> I don't recall the exact discussion, but was there something about
> enum labels that made it impossible to make them transactional, or was
> it just "lots of work, let's do that later instead" to get the feature
> in? If the second, does anyone have plans to fix it? It is a quite
> annoying limitation :(

I don't know of any plans to fix it.

>
> That said, this functionality would be useful even *if* the enum label
> addition was made transactional...
>

Right.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2012-08-23 11:39:02 Re: alter enum add value if not exists
Previous Message Amit Kapila 2012-08-23 11:09:51 Re: to_timestamp() too loose?