=?UTF-8?Q?Jorge_Sol=C3=B3rzano?= <jorsol@gmail.com> writes:
> AFAICT this is a libpq functionality, and since the JDBC driver is not
> libpq based then it can't use that functionality.
> And it doesn't looks to be that useful for JDBC users:
It's not really useful for programs, I think. ISTM a program would prefer
to have access to the individual fields of the error message. There
definitely are fields in there that are of interest, for some messages:
regression=# create table t1 (f1 int primary key);
CREATE TABLE
regression=# create table t2 (f2 int references t1);
CREATE TABLE
regression=# insert into t2 values(11);
ERROR: insert or update on table "t2" violates foreign key constraint "t2_f2_fkey"
DETAIL: Key (f2)=(11) is not present in table "t1".
regression=# \errverbose
ERROR: 23503: insert or update on table "t2" violates foreign key constraint "t2_f2_fkey"
DETAIL: Key (f2)=(11) is not present in table "t1".
SCHEMA NAME: public
TABLE NAME: t2
CONSTRAINT NAME: t2_f2_fkey
LOCATION: ri_ReportViolation, ri_triggers.c:3324
So really what would be appropriate for JDBC to provide, IMO, is
some equivalent of libpq's PQresultErrorField(). Perhaps that's
already there.
regards, tom lane