pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jorge Solórzano <jorsol@gmail.com>
Cc: Thomas Kellerer <spam_eater@gmx.net>
Cc: List <pgsql-jdbc@postgresql.org>
Subject: Re: Using \errverbose through JDBC
Date: Wed, 01 Feb 2017 10:24:01 -0500
Message-ID: <7868.1485962641@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+cVU8N3wJ0gXtqSkx3LhuTiMPs40YeDpH4iuiRunYZRx8Bo9w@mail.gmail.com>
References: <o6sn6c$280$1@blaine.gmane.org>
	<CA+cVU8N3wJ0gXtqSkx3LhuTiMPs40YeDpH4iuiRunYZRx8Bo9w@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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


-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc



view thread (9+ messages)  latest in thread

Message-ID: <7868.1485962641@sss.pgh.pa.us>
Permalink:  ../7868.1485962641@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7868.1485962641@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jorsol@gmail.com, spam_eater@gmx.net
  Subject: Re: Using \errverbose through JDBC
  In-Reply-To: <7868.1485962641@sss.pgh.pa.us>
  References: <o6sn6c$280$1@blaine.gmane.org> <CA+cVU8N3wJ0gXtqSkx3LhuTiMPs40YeDpH4iuiRunYZRx8Bo9w@mail.gmail.com> <7868.1485962641@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox