[HACKERS] alter enum add value regression - Mailing list pgsql-hackers

From Andrew Dunstan
Subject [HACKERS] alter enum add value regression
Date
Msg-id a883705b-4592-a005-ef3b-562bb33af87e@dunslane.net
Whole thread Raw
List pgsql-hackers
It's just been brought to my attention that the following which worked
in current releases is broken in master:

 BEGIN; CREATE TYPE test_enum AS ENUM ('v1','v2'); ALTER TYPE test_enum OWNER TO postgres; CREATE TABLE test_table
(test_coltest_enum DEFAULT 'v1'::test_enum); COMMIT; 


The reason is shown I think in this comment in enum.c:

   * We also insist that the type's pg_type row not be HEAP_UPDATED.  If it   * is, we can't tell whether the row was
createdor only modified in the   * apparent originating xact, so it might be older than that xact.    (We do   * not
worrywhether the enum value is HEAP_UPDATED; if it is, we might   * think it's too new and throw an unnecessary error,
butwe won't allow   * an unsafe case.) 


Clearly this isn't just academic since someone has tripped over it. This
example is based on code in an existing extension install script. Now
the extension is probably somewhat broken because it assumes the
existence of a "postgres" user, but that's a beside the point.


It's not clear to me that we can do anything about this, and the changes
that we made address numerous complaints that we have had about not
being able to add values to an enum in a transaction, so I'm very far
from keen to revert it. But this is sure a pity. At the very least it
deserves a release note.


cheers


andrew







pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [HACKERS] exposing wait events for non-backends (was: Trackingwait event for latches)
Next
From: Robert Haas
Date:
Subject: [HACKERS] compiler warning in set_tablefunc_size_estimates