Re: Can I User @@error of MS SQL in postgresql

From: Joel Burton <joel(at)joelburton(dot)com>
To: Ian Harding <ianh(at)tpchd(dot)org>
Cc: annachau(at)hongkong(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: Can I User @@error of MS SQL in postgresql
Date: 2002-12-06 15:00:37
Message-ID: 20021206150037.GA17685@temp.joelburton.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)joelburton(dot)com | joelburton.com | aim: wjoelburton
Independent Knowledge Management Consultant

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Matthew Gabeler-Lee 2002-12-06 15:29:45 Re: Query breaking with unknown expression type (lost s
Previous Message Ian Harding 2002-12-06 14:52:14 Re: Can I User @@error of MS SQL in postgresql