Re: [JDBC] Using \errverbose through JDBC

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [JDBC] Using \errverbose through JDBC
Дата
Msg-id 7868.1485962641@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [JDBC] Using \errverbose through JDBC  (Jorge Solórzano <jorsol@gmail.com>)
Ответы Re: [JDBC] Using \errverbose through JDBC  (Thomas Kellerer <spam_eater@gmx.net>)
Re: Using \errverbose through JDBC  (Thomas Kellerer <spam_eater@gmx.net>)
Список pgsql-jdbc
=?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


В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Jorge Solórzano
Дата:
Сообщение: Re: [JDBC] Using \errverbose through JDBC
Следующее
От: Thomas Kellerer
Дата:
Сообщение: Re: Using \errverbose through JDBC