Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XYvC7-0008Da-MB for pgsql-bugs@arkaria.postgresql.org; Tue, 30 Sep 2014 11:02:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XYvC7-00062y-53 for pgsql-bugs@arkaria.postgresql.org; Tue, 30 Sep 2014 11:02:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XYvC5-00060e-Fx for pgsql-bugs@postgresql.org; Tue, 30 Sep 2014 11:02:09 +0000 Received: from smtp-out1.gransy.com ([77.78.126.51]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XYvC1-0003gf-On for pgsql-bugs@postgresql.org; Tue, 30 Sep 2014 11:02:08 +0000 Received: from smtp-out.gransy.com (localhost [127.0.0.1]) by smtp-out1.gransy.com (Postfix) with ESMTP id 4F80436003F for ; Tue, 30 Sep 2014 13:02:04 +0200 (CEST) Received: from smtp.gransy.com (smtp.simplia.cz [77.78.126.20]) by smtp-out1.gransy.com (Postfix) with ESMTP id 0BCFF360005; Tue, 30 Sep 2014 13:02:04 +0200 (CEST) Received: from 2.emaily.eu (elizabeth.gransy.com [89.187.132.199]) (Authenticated sender: tv@fuzzy.cz) by smtp.gransy.com (Postfix) with ESMTPA id 9732B19A03BD; Tue, 30 Sep 2014 13:02:00 +0200 (CEST) Received: from 212.47.19.46 (SquirrelMail authenticated user tv@fuzzy.cz) by 2.emaily.eu with HTTP; Tue, 30 Sep 2014 13:02:02 +0200 Message-ID: <4330b13cec2a6288d0de2a5be1c7aa96.squirrel@2.emaily.eu> In-Reply-To: <20140930104330.7639.71922@wrigleys.postgresql.org> References: <20140930104330.7639.71922@wrigleys.postgresql.org> Date: Tue, 30 Sep 2014 13:02:02 +0200 Subject: Re: BUG #11524: Unable to add value to ENUM when having AUTOCOMMIT disabled in psql From: "Tomas Vondra" To: feikesteenbergen@gmail.com Cc: pgsql-bugs@postgresql.org User-Agent: SquirrelMail/1.4.22 MIME-Version: 1.0 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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