• Tom Lane's avatar
    Relax transactional restrictions on ALTER TYPE ... ADD VALUE. · 15bc038f
    Tom Lane authored
    To prevent possibly breaking indexes on enum columns, we must keep
    uncommitted enum values from getting stored in tables, unless we
    can be sure that any such column is new in the current transaction.
    
    Formerly, we enforced this by disallowing ALTER TYPE ... ADD VALUE
    from being executed at all in a transaction block, unless the target
    enum type had been created in the current transaction.  This patch
    removes that restriction, and instead insists that an uncommitted enum
    value can't be referenced unless it belongs to an enum type created
    in the same transaction as the value.  Per discussion, this should be
    a bit less onerous.  It does require each function that could possibly
    return a new enum value to SQL operations to check this restriction,
    but there aren't so many of those that this seems unmaintainable.
    
    Andrew Dunstan and Tom Lane
    
    Discussion: <4075.1459088427@sss.pgh.pa.us>
    15bc038f
enum.sql 8.5 KB