Thread: BUG #2812: Transaction is aborted after error

BUG #2812: Transaction is aborted after error

From
"Alex Piyevsky"
Date:
The following bug has been logged online:

Bug reference:      2812
Logged by:          Alex Piyevsky
Email address:      Alex_Piyevsky@ibi.com
PostgreSQL version: 8.0.1
Operating system:   Linux Kernel-2.4.21-glibc-2.3.2 x86 32bit
Description:        Transaction is aborted after error
Details:

We issue a command which drops the existing table and recreates the table
under the same name, all in one transaction.  If the table does not
previously exist, an error message is returned for the drop command and the
transaction aborts with the following:

current transaction is aborted, commands ignored until end of transaction
block

please advise

Re: BUG #2812: Transaction is aborted after error

From
Alvaro Herrera
Date:
Alex Piyevsky wrote:

> We issue a command which drops the existing table and recreates the table
> under the same name, all in one transaction.  If the table does not
> previously exist, an error message is returned for the drop command and the
> transaction aborts with the following:
>
> current transaction is aborted, commands ignored until end of transaction
> block

This is the intended behavior.  In 8.2 you can use "DROP TABLE IF
EXISTS".  In previous versions you can set a savepoint before the DROP
TABLE; or you can do the DROP TABLE outside the transaction.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

Re: BUG #2812: Transaction is aborted after error

From
Date:
Thank you for your help and prompt response.

Regards,
Alex

-----Original Message-----
From: Alvaro Herrera [mailto:alvherre@commandprompt.com]=20
Sent: Wednesday, December 06, 2006 5:43 PM
To: Piyevsky, Alex
Cc: pgsql-bugs@postgresql.org
Subject: Re: [BUGS] BUG #2812: Transaction is aborted after error

Alex Piyevsky wrote:

> We issue a command which drops the existing table and recreates the
table
> under the same name, all in one transaction.  If the table does not
> previously exist, an error message is returned for the drop command
and the
> transaction aborts with the following:
>=20
> current transaction is aborted, commands ignored until end of
transaction
> block=20

This is the intended behavior.  In 8.2 you can use "DROP TABLE IF
EXISTS".  In previous versions you can set a savepoint before the DROP
TABLE; or you can do the DROP TABLE outside the transaction.

--=20
Alvaro Herrera
http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.