From: | Francois Suter <dba(at)paragraf(dot)ch> |
---|---|
To: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Error codes |
Date: | 2002-12-12 10:36:04 |
Message-ID: | BA1E2524.25DE%dba@paragraf.ch |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi all (again),
I have a database with quite a few UNIQUE constraints on foreign key pairs.
Logically when I try to insert a pair that already exists I get an error
from the PostgreSQL backend. I assume that such an error has an associated
error code and that such an error code is quite different from the one
generated, say, when a relationship is missing.
My question is then: is it possible to retrieve this error code, especially
in PHP, where it seems that the only function related to errors is
pg_errormessage() which only returns a string with no error code.
The thing is I would like to be able to differentiate between errors that
are expected (people trying to create a foreign key pair that already
exists) and which should just generate a warning and an error that happens
because someone stumbled on a bug (e.g. writing a null value to a NOT NULL
field).
Any hope of achieving that with PHP?
(I tried to look for error codes in the idocs and got either nothing or too
many hits, hence my previous mail :-)
--------
Francois
Home page: http://www.monpetitcoin.com/
"We waste our time spending money we don't have to buy things we don't need
to impress people we don't like"
From | Date | Subject | |
---|---|---|---|
Next Message | Oleg Bartunov | 2002-12-12 10:53:55 | Re: PostgreSQL idocs |
Previous Message | Francois Suter | 2002-12-12 10:26:31 | PostgreSQL idocs |