"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