Re: ALTER TYPE ... ADD VALUE issue

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: ALTER TYPE ... ADD VALUE issue
Дата
Msg-id 544557E9.4090201@aklaver.com
обсуждение исходный текст
Ответ на ALTER TYPE ... ADD VALUE issue  (Victor Yegorov <vyegorov@gmail.com>)
Ответы Re: ALTER TYPE ... ADD VALUE issue  (Victor Yegorov <vyegorov@gmail.com>)
Список pgsql-general
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@aklaver.com


В списке pgsql-general по дате отправления:

Предыдущее
От: Victor Yegorov
Дата:
Сообщение: ALTER TYPE ... ADD VALUE issue
Следующее
От: Victor Yegorov
Дата:
Сообщение: Re: ALTER TYPE ... ADD VALUE issue