Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id A6CEE2E01B1 for ; Sun, 25 Nov 2007 22:59:58 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 62684-02-4 for ; Sun, 25 Nov 2007 22:59:55 -0400 (AST) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 7C7692E2DCD for ; Sun, 25 Nov 2007 22:55:59 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id lAQ2tvWJ026527; Sun, 25 Nov 2007 21:55:58 -0500 (EST) To: Jeffrey Brendecke cc: pgsql-interfaces@postgresql.org Subject: Re: Retrieving multiple error messages via libpq In-reply-to: <798544.38898.qm@web26905.mail.ukl.yahoo.com> References: <798544.38898.qm@web26905.mail.ukl.yahoo.com> Comments: In-reply-to Jeffrey Brendecke message dated "Mon, 26 Nov 2007 02:48:10 +0000" Date: Sun, 25 Nov 2007 21:55:57 -0500 Message-ID: <26526.1196045757@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200711/15 X-Sequence-Number: 6659 Jeffrey Brendecke writes: > 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" > How is the additional error message retrieved? It isn't, because there isn't any additional message. When you submit multiple commands in a single PQexec string (as I suspect you did), the backend abandons processing the string as soon as there's one error. psql, however, chops up its input at semicolons and submits each command as a separate PQexec. regards, tom lane