Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id C94E6B5DBC1 for ; Wed, 28 Sep 2011 12:40:48 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 99168-05 for ; Wed, 28 Sep 2011 15:40:42 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 85563B5D801 for ; Wed, 28 Sep 2011 12:40:42 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p8SFebt5003544; Wed, 28 Sep 2011 11:40:37 -0400 (EDT) To: depstein cc: Alvaro Herrera , mmoncure , Pg Bugs Subject: Re: Problems with ENUM type manipulation in 9.1 In-reply-to: <1317220852-sup-4032@alvh.no-ip.org> References: <29F36C7C98AB09499B1A209D48EAA615B7653DBC8A@mail2a.alliedtesting.com> <29F36C7C98AB09499B1A209D48EAA615B7653DBCAB@mail2a.alliedtesting.com> <1317220852-sup-4032@alvh.no-ip.org> Comments: In-reply-to Alvaro Herrera message dated "Wed, 28 Sep 2011 11:51:40 -0300" Date: Wed, 28 Sep 2011 11:40:37 -0400 Message-ID: <3543.1317224437@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.404 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-0.504 X-Spam-Level: X-Archive-Number: 201109/215 X-Sequence-Number: 31232 Alvaro Herrera writes: > Excerpts from depstein's message of miƩ sep 28 07:21:17 -0300 2011: >> ALTER TYPE ... ADD VALUE does not work inside transaction blocks, period, whether they are executed as a multi-command string or one query at a time. Try it: > The reason it is not allowed is because it breaks stuff (I cannot > remember what). Inconvenient, yes. "Broken", perhaps. But it's > working as designed. If you're interested, you could examine the old > threads that led to this behavior and see if it can be improved. But > just removing the check won't do. The comment beside the code says what it breaks: case T_AlterEnumStmt: /* ALTER TYPE (enum) */ /* * We disallow this in transaction blocks, because we can't cope * with enum OID values getting into indexes and then having their * defining pg_enum entries go away. */ PreventTransactionChain(isTopLevel, "ALTER TYPE ... ADD"); AlterEnum((AlterEnumStmt *) parsetree); break; As Merlin says, this is not a bug. It's a design compromise that we made after quite some careful consideration, and we're unlikely to reconsider it unless someone thinks of an actually better solution. You might care to review the "WIP: extensible enums" thread in pgsql-hackers during October 2010 to see the issues and alternatives that were considered. BTW, I imagine that the reason that manually adding rows to pg_enum no longer works with any reliability at all is that the manual procedure isn't cognizant of the new rules about even vs odd OIDs in pg_enum. Not that it really worked before --- once the OID counter wrapped around, you'd be pretty well screwed. As Alvaro says, manual alterations of the system catalogs never have been supported, meaning that we will never offer a guarantee that something that (more or less) worked in a previous release will still work in newer ones. regards, tom lane