Re: Transactional enum additions - was Re: Alter or rename enum value
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrew Dunstan <andrew@dunslane.net>
Cc: Christophe Pettus <xof@thebuild.com>,
"David G. Johnston" <david.g.johnston@gmail.com>,
Matthias Kurz <m.kurz@irregular.at>,
Jim Nasby <Jim.Nasby@bluetreble.com>,
"pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2016-09-04T00:04:20Z
Lists: pgsql-hackers
Attachments
- transactional_enum_additions-v2.patch (text/x-diff) patch v2
Andrew Dunstan <andrew@dunslane.net> writes: > OK, did that. Here is a patch that is undocumented but I think is > otherwise complete. It's been tested a bit and we haven't been able to > break it. Comments welcome. Got around to looking at this. Attached is a revised version that I think is in committable shape. The main non-cosmetic change is that the test for "type was created in same transaction as new value" now consists of comparing the xmins of the pg_type and pg_enum rows, without consulting GetCurrentTransactionId(). I did not like the original coding because it would pointlessly disallow references to enum values that were created in a parent transaction of the current subxact. This way is still leaving some subxact use-cases on the table, as noted in the code comments, but it's more flexible than before. Barring objections I'll push this soon. regards, tom lane
Commits
-
Relax transactional restrictions on ALTER TYPE ... ADD VALUE (redux).
- 212fab9926b2 12.0 landed
-
Partially restore comments discussing enum renumbering hazards.
- c9e2e2db5c20 9.4.0 cited
-
Allow adding values to an enum type created in the current transaction.
- 7b90469b7176 9.3.0 cited