Search Postgresql Archives

Re: ALTER TYPE ... ADD VALUE issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/20/2014 11:30 AM, Victor Yegorov wrote:
Greetings.


I'm observing the following on 9.3.5 and also on 9.4beta3:

\set AUTOCOMMIT on
CREATE TYPE enum_type AS ENUM ('bad', 'good');
CREATE TYPE
ALTER TYPE enum_type ADD VALUE 'so-so' AFTER 'bad';
ALTER TYPE
DROP TYPE enum_type;
DROP TYPE;
\set AUTOCOMMIT off
CREATE TYPE enum_type AS ENUM ('bad', 'good');
CREATE TYPE
COMMIT;
COMMIT
ALTER TYPE enum_type ADD VALUE 'so-so' AFTER 'bad';
ERROR:  ALTER TYPE ... ADD cannot run inside a transaction block


What is wrong here?

http://www.postgresql.org/docs/9.3/interactive/sql-altertype.html

ALTER TYPE ... ADD VALUE (the form that adds a new value to an enum type) cannot be executed inside a transaction block.

With \set AUTOCOMMIT off the COMMIT ended one transaction block and started another. You then ran the ALTER TYPE .. ADD in the new block which is not allowed.



--
Victor Y. Yegorov


--
Adrian Klaver
adrian.klaver@xxxxxxxxxxx


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux