Re: savepoint improvements - Mailing list pgsql-hackers

From Tom Lane
Subject Re: savepoint improvements
Date
Msg-id 28187.1169405100@sss.pgh.pa.us
Whole thread Raw
In response to Re: savepoint improvements  ("Joshua D. Drake" <jd@commandprompt.com>)
List pgsql-hackers
"Joshua D. Drake" <jd@commandprompt.com> writes:
> At a minimum we need to stop forcing a rollback just because we have a
> syntax error. It makes development a complete pain in the butt and is
> one of the most, "WTF" looks I get when I am training.

> postgres=# begin;
> BEGIN
> postgres=# create table foo (bar ints);
> ERROR:  type "ints" does not exist
> postgres=# create table foo (bar int);
> ERROR:  current transaction is aborted, commands ignored until end of
> transaction block
> postgres=#

ON_ERROR_ROLLBACK is what you are looking for.

regression=# \set ON_ERROR_ROLLBACK on
regression=# begin;
BEGIN
regression=# create table foo (bar ints);
ERROR:  type "ints" does not exist
LINE 1: create table foo (bar ints);                             ^
regression=# create table foo (bar int);
CREATE TABLE
regression=# commit;
COMMIT
regression=#

        regards, tom lane


pgsql-hackers by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: savepoint improvements
Next
From: "Jim C. Nasby"
Date:
Subject: Re: [GENERAL] Autovacuum Improvements