Re: [PATCH] Alter or rename enum value

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: emre@hasegeli.com
Cc: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>, Andrew Dunstan <andrew@dunslane.net>, Matthias Kurz <m.kurz@irregular.at>, Jim Nasby <Jim.Nasby@bluetreble.com>, "David G. Johnston" <david.g.johnston@gmail.com>
Date: 2016-08-21T14:28:18Z
Lists: pgsql-hackers
Emre Hasegeli <emre@hasegeli.com> writes:
>> +        ReleaseCatCacheList(list);
>> +        heap_close(pg_enum, RowExclusiveLock);

> Maybe we better release them before reporting error, too.  I would
> release the list after the loop, close the heap before ereport().

Transaction abort will clean up such resources just fine; if it did
not, then any function you call would have problems if it threw an
error.  I would not contort the logic to free stuff before ereport.

			regards, tom lane


Commits

  1. Relax transactional restrictions on ALTER TYPE ... ADD VALUE (redux).

  2. Partially restore comments discussing enum renumbering hazards.

  3. Allow adding values to an enum type created in the current transaction.