Re: Can I User @@error of MS SQL in postgresql - Mailing list pgsql-general

From Ian Harding
Subject Re: Can I User @@error of MS SQL in postgresql
Date
Msg-id sdf0496a.083@mail.tpchd.org
Whole thread Raw
In response to Can I User @@error of MS SQL in postgresql  ("annachau" <annachau@hongkong.com>)
Responses Re: Can I User @@error of MS SQL in postgresql  (Joel Burton <joel@joelburton.com>)
List pgsql-general
PostgreSQL is much more strict about error handling.  MSSQLServer will continue merrily along without interrupting the
procedureor affecting the in-progress transaction if errors occur.  It is up to you to catch them and decide how to
handlethem.  PGSQL will ignore all further queries and roll back the transaction automatically if any errors are
returnedfrom a query.  In other words, you don't have to worry about it.  If there are cases where the action failing
wouldbe OK, you need to test for those cases (i.e. duplicate key already exists) before the action.  Keep in mind that
thosechecks will not always be valid given the status of other transactions and your isolation level. 

Isn't this fun?

Ian Harding
Programmer/Analyst II
Tacoma-Pierce County Health Department
iharding@tpchd.org
(253) 798-3549

>>> "annachau" <annachau@hongkong.com> 12/05/02 11:13PM >>>
I have a plpgsql function to insert a record into a table.  In MS SQL, I can user @@error to check the insert action is
completedor not.  What can I do in postgresql? 
Thanks a lot.

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly


pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: reindexing
Next
From: Joel Burton
Date:
Subject: Re: Can I User @@error of MS SQL in postgresql