On Tue, Aug 17, 2004 at 02:56:19PM -0400, Tom Lane wrote:
> Bruce Momjian <[EMAIL PROTECTED]> 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 key
        if 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 | [EMAIL PROTECTED] | http://www.fi.muni.cz/~adelton/
 .project: Perl, mod_perl, DBI, Oracle, large Web systems, XML/XSL, ...
                Only self-confident people can be simple.

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to