Re: Does psql use nested transactions? - Mailing list pgsql-hackers

From Merlin Moncure
Subject Re: Does psql use nested transactions?
Date
Msg-id 6EE64EF3AB31D5448D0007DD34EEB3412A744A@Herge.rcsinc.local
Whole thread Raw
In response to Does psql use nested transactions?  (Philip Warner <pjw@rhyme.com.au>)
Responses Re: Does psql use nested transactions?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> In 8.0 beta 1 I just tried:
>
>      psql template1
>      > begin;
>      > select * from pg_class;
>      ... got stuff ...
>      > select * from aaa;
>      ERROR: relation "zzz" does not exist
>      > select * from pg_class;
>      ERROR: current transaction is aborted....
>
> Should psql run every statement in a nested transaction and only
rollback
> that TX? Or is that not possible/desirable. If possible, this would be
a
> *great* feature for those  of use prone to mis-spellings.

Nested transactions are not designed to help you with spelling errors.
They are designed to give you more flexible options with rolling back
data to keep it in a valid state.

psql is designed to follow the same logical statement progression as any
other connection to the database.  Your suggestion could muck up sql
scripts piped through it to the database.

If you make a lot of spelling errors, just macro 'savepoint x' and fire
that when typing multiple related statements into psql after each
statement.

Merlin


pgsql-hackers by date:

Previous
From: "Min Xu (Hsu)"
Date:
Subject: Re: We have got a serious problem with pg_clog/WAL synchronization
Next
From: Robert Treat
Date:
Subject: Re: Release notes for upgrading