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

From Honza Pazdziora
Subject Re: Does psql use nested transactions?
Date
Msg-id 20040818063919.GB14034@anxur.fi.muni.cz
Whole thread Raw
In response to Re: Does psql use nested transactions?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Does psql use nested transactions?
List pgsql-hackers
On Tue, Aug 17, 2004 at 02:56:19PM -0400, Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Doing it only for interactive mode seems too error-prone to me (it works
> > in psql, but not from my script).
> 
> You're missing the point: a script cannot safely work this way.  A human
> typing at the terminal can notice that his command failed and react to
> that, but a psql script cannot.

It is not just a typo that you make in the SQL command. You often need
to do
insert into table which has primary keyif the insert failed, do update of the existing record

It should be upto the application to decide if the failed insert
should lead to abortion of the transaction, or if it should be
silently ignored and based on the return value of the insert proceed
with update.

-- 
------------------------------------------------------------------------Honza Pazdziora | adelton@fi.muni.cz |
http://www.fi.muni.cz/~adelton/.project:Perl, mod_perl, DBI, Oracle, large Web systems, XML/XSL, ...    Only
self-confidentpeople can be simple.
 


pgsql-hackers by date:

Previous
From: Oliver Jowett
Date:
Subject: Re: 7.4.3 & 8.0.0beta1 + Solaris 9: default pg_hba.conf
Next
From: Christopher Kings-Lynne
Date:
Subject: Re: Does psql use nested transactions?