From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Allow adding values to an enum type created in the current trans |
Date: | 2012-12-01 19:27:43 |
Message-ID: | E1Tesj1-00081a-Kc@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Allow adding values to an enum type created in the current transaction.
Normally it is unsafe to allow ALTER TYPE ADD VALUE in a transaction block,
because instances of the value could be added to indexes later in the same
transaction, and then they would still be accessible even if the
transaction rolls back. However, we can allow this if the enum type itself
was created in the current transaction, because then any such indexes would
have to go away entirely on rollback.
The reason for allowing this is to support pg_upgrade's new usage of
pg_restore --single-transaction: in --binary-upgrade mode, pg_dump emits
enum types as a succession of ALTER TYPE ADD VALUE commands so that it can
preserve the values' OIDs. The support is a bit limited, so we'll leave
it undocumented.
Andres Freund
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/7b90469b71761d240bf5efe3ad5bbd228429278e
Modified Files
--------------
src/backend/commands/typecmds.c | 23 +++++++++++++++++++++--
src/backend/tcop/utility.c | 9 +--------
src/include/commands/typecmds.h | 2 +-
src/test/regress/expected/enum.out | 24 ++++++++++++++++++++++++
src/test/regress/sql/enum.sql | 27 +++++++++++++++++++++++++++
5 files changed, 74 insertions(+), 11 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2012-12-01 21:05:00 | pgsql: Make sure sharedir/extension/ directory is created when needed. |
Previous Message | Bruce Momjian | 2012-12-01 17:07:19 | pgsql: In pg_upgrade, remove 'set -x' from test script. |