Retrieving multiple error messages via libpq

Jeffrey Brendecke <[email protected]>
Newsgroups gmane.comp.db.postgresql.interfaces
Message-ID <[email protected]>
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

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [email protected] so that your
       message can get through to the mailing list cleanly
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.