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

From Joel Burton
Subject Re: Can I User @@error of MS SQL in postgresql
Date
Msg-id 20021206150037.GA17685@temp.joelburton.com
Whole thread Raw
In response to Re: Can I User @@error of MS SQL in postgresql  ("Ian Harding" <ianh@tpchd.org>)
List pgsql-general
On Fri, Dec 06, 2002 at 06:52:14AM -0800, Ian Harding wrote:
> PostgreSQL is much more strict about error handling.  MSSQLServer will
> continue merrily along without interrupting the procedure or affecting
> the in-progress transaction if errors occur.  It is up to you to catch
> them and decide how to handle them.  PGSQL will ignore all further
> queries and roll back the transaction automatically if any errors are
> returned from a query.  In other words, you don't have to worry about
> it.  If there are cases where the action failing would be OK, you need
> to test for those cases (i.e. duplicate key already exists) before the
> action.  Keep in mind that those checks will not always be valid given
> the status of other transactions and your isolation level.

Given that some ODBC apps don't fully expose the PG error message
(Access, for instance, can either show you a dialog box w/the PG error
message, or give you a generic error code that you app can act on, but
not both), it would would be helpful to be able to figure out what error
happened.

Does anyone know of anything like "SELECT last_error" to find the last
error on a connection? This way, in an Access error-handling function, I
could at least try to dig in and get the PG error message, parse it, and
provide some meaningful help to the user.

- J.
--

Joel BURTON  |  joel@joelburton.com  |  joelburton.com  |  aim: wjoelburton
Independent Knowledge Management Consultant

pgsql-general by date:

Previous
From: "Ian Harding"
Date:
Subject: Re: Can I User @@error of MS SQL in postgresql
Next
From: Matthew Gabeler-Lee
Date:
Subject: Re: Query breaking with unknown expression type (lost s