From: Jeffrey Brendecke <yakhki@yahoo.de>
To: pgsql-interfaces@postgresql.org
Subject: Retrieving multiple error messages via libpq
Date: Mon, 26 Nov 2007 02:48:10 +0000 (GMT)
Message-ID: <798544.38898.qm@web26905.mail.ukl.yahoo.com> (raw)
I am working on a client that interfaces to the database via libpq, but cannot see how to get all error messages in some cases.
For testing purposes, I created the following table:
CREATE TABLE IdOnly
(
id INTEGER PRIMARY KEY
);
When I submit the following SQL statement for execution via the psql client:
'BEGIN TRANSACTION; INSERT INTO IdOnly (id) VALUES (40); INSERT INTO IdOnly (id) VALUES (21); INSERT INTO IdOnly (id) VALUES (42); COMMIT TRANSACTION;'
I get the following error messages (this failure is expected):
ERROR: duplicate key violates unique constraint "idonly_pkey"
ERROR: current transaction is aborted, commands ignored until end of transaction block
However, when retreiving the error message via PQresultErrorMessage(), I get:
ERROR: duplicate key violates unique constraint "idonly_pkey"
and through PQresultErrorField(, PGresult*, PG_DIAG_MESSAGE_PRIMARY ), I get only:
duplicate key violates unique constraint "idonly_pkey"
Calling PQresultErrorField( PGresult*, PG_DIAG_MESSAGE_DETAIL )" returns no additional information.
How is the additional error message retrieved?
Machen Sie Yahoo! zu Ihrer Startseite. Los geht's:
http://de.yahoo.com/set
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 using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: yakhki@yahoo.de
Subject: Re: Retrieving multiple error messages via libpq
In-Reply-To: <798544.38898.qm@web26905.mail.ukl.yahoo.com>
* 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