Re: ALTER TYPE ... ADD VALUE issue

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Victor Yegorov <vyegorov(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: ALTER TYPE ... ADD VALUE issue
Date: 2014-10-20 19:18:13
Message-ID: 54455FF5.60406@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/20/2014 12:03 PM, Tom Lane wrote:
> Victor Yegorov <vyegorov(at)gmail(dot)com> writes:
>> 2014-10-20 21:43 GMT+03:00 Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>:
>>> With \set AUTOCOMMIT off the COMMIT ended one transaction block and
>>> started another.
>
>> I don't think `COMMIT` starts a new transaction block here,
>> as I can run `VACUUM` after it, and vacuum also cannot be run inside
>> transaction block.
>
> psql knows not to issue BEGIN before a VACUUM command. It doesn't
> know that about ALTER TYPE ... ADD VALUE.

I did some testing with Victors examples and I came away confused(:

Tested on:

test=> select version();
version

-----------------------------------------------------------------------------------------------------------------------------
PostgreSQL 9.3.5 on i686-pc-linux-gnu, compiled by gcc (SUSE Linux)
4.8.1 20130909 [gcc-4_8-branch revision 202388], 32-bit

test=> \set AUTOCOMMIT on;
unrecognized Boolean value; assuming "on"
test=> \set
AUTOCOMMIT = 'on;'

test=> \set AUTOCOMMIT off;
unrecognized Boolean value; assuming "on"
test=> \set
AUTOCOMMIT = 'off;'

Not sure how assuming on becomes off?
This is the same if I quote the values.

http://www.postgresql.org/docs/9.3/interactive/app-psql.html#APP-PSQL-VARIABLES

AUTOCOMMIT

The autocommit-off mode works by issuing an implicit BEGIN for you, just
before any command that is not already in a transaction block and is not
itself a BEGIN or other transaction-control command, nor a command that
cannot be executed inside a transaction block (such as VACUUM).

The above would seem to imply it should work, in contrast to what I
originally said.

>
> regards, tom lane
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2014-10-20 19:26:33 Re: ALTER TYPE ... ADD VALUE issue
Previous Message Tom Lane 2014-10-20 19:03:24 Re: ALTER TYPE ... ADD VALUE issue