pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tv@fuzzy.cz>
To: feikesteenbergen@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #11524: Unable to add value to ENUM when having AUTOCOMMIT disabled in psql
Date: Tue, 30 Sep 2014 13:02:02 +0200
Message-ID: <4330b13cec2a6288d0de2a5be1c7aa96.squirrel@2.emaily.eu> (raw)
In-Reply-To: <20140930104330.7639.71922@wrigleys.postgresql.org>
References: <20140930104330.7639.71922@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Hi,

Dne 30 Září 2014, 12:43, feikesteenbergen@gmail.com napsal(a):
> The following bug has been logged on the website:
>
> Bug reference:      11524
> Logged by:          Feike Steenbergen
> Email address:      feikesteenbergen@gmail.com
> PostgreSQL version: 9.4beta2
> Operating system:   Debian
> Description:
>
> If I want to add a value to an ENUM type, I cannot do so when having
> AUTOCOMMIT enabled.
>
> To reproduce:
> \set ECHO queries
> CREATE TYPE mood AS ENUM ('sad', 'ok', 'happy');
> ALTER TYPE mood ADD VALUE 'autocommit enabled';
> \set AUTOCOMMIT OFF
> ALTER TYPE mood ADD VALUE 'autocommit disabled';
>
>
> Output:
> CREATE TYPE mood AS ENUM ('sad', 'ok', 'happy');
> CREATE TYPE
> ALTER TYPE mood ADD VALUE 'autocommit enabled';
> ALTER TYPE
> ALTER TYPE mood ADD VALUE 'autocommit disabled';
> psql:autocommit_enum.sql:5: ERROR:  ALTER TYPE ... ADD cannot run inside a
> transaction block
>
> I have this issue on 9.1 - 9.5. (This issue does not occur on 9.0 as
> adding
> "ADD VALUE" was added in 9.1).

I don't understand why you think this is a bug? By disabling autocommit,
psql essentially adds a BEGIN before the ALTER TABLE, wrapping it in a
transaction block [1]. And ADD VALUE can't run in a transaction block,
which is a known limitation as explained in [2].

While this is unfortunate and maybe annoying, it's not a bug.

regards
Tomas

[1] http://www.postgresql.org/docs/9.1/static/app-psql.html
[2] http://www.postgresql.org/docs/9.1/static/sql-altertype.html



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



view thread (4+ messages)  latest in thread

Message-ID: <4330b13cec2a6288d0de2a5be1c7aa96.squirrel@2.emaily.eu>
Permalink:  ../4330b13cec2a6288d0de2a5be1c7aa96.squirrel@2.emaily.eu/
Also on:    postgresql.org/message-id/4330b13cec2a6288d0de2a5be1c7aa96.squirrel@2.emaily.eu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tv@fuzzy.cz, feikesteenbergen@gmail.com
  Subject: Re: BUG #11524: Unable to add value to ENUM when having AUTOCOMMIT disabled in psql
  In-Reply-To: <4330b13cec2a6288d0de2a5be1c7aa96.squirrel@2.emaily.eu>
  References: <20140930104330.7639.71922@wrigleys.postgresql.org> <4330b13cec2a6288d0de2a5be1c7aa96.squirrel@2.emaily.eu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox