X-Original-To: pgsql-interfaces@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B517B474E53; Mon, 10 Feb 2003 23:50:03 -0500 (EST) Received: from crtntx1-ar11-4-62-011-208.crtntx1.dsl-verizon.net (crtntx1-ar11-4-62-009-178.crtntx1.dsl-verizon.net [4.62.9.178]) by postgresql.org (Postfix) with ESMTP id EC184474E44; Mon, 10 Feb 2003 23:50:02 -0500 (EST) Received: from reliant.home.pri (reliant.home.pri [192.168.1.25]) by crtntx1-ar11-4-62-011-208.crtntx1.dsl-verizon.net (Postfix) with ESMTP id 524A03018; Mon, 10 Feb 2003 22:50:35 -0600 (CST) Subject: Re: Connection Error message in ECPG From: Matthew Vanecek To: Michael Meskes Cc: Postgresql Interfaces List In-Reply-To: <20030210124426.GI19195@feivel.fam-meskes.de> References: <1044733838.6526.7.camel@reliant.home.pri> <20030210124426.GI19195@feivel.fam-meskes.de> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-RQx6I7hpUmHReYaLh/6r" Organization: Message-Id: <1044939011.6526.29.camel@reliant.home.pri> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 Date: 10 Feb 2003 22:50:11 -0600 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/27 X-Sequence-Number: 3648 --=-RQx6I7hpUmHReYaLh/6r Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Mon, 2003-02-10 at 06:44, Michael Meskes wrote: > On Sat, Feb 08, 2003 at 01:50:38PM -0600, Matthew Vanecek wrote: > > What would it take to get a better error message out of the ECPG > > interface, when a connection fails? It uses PQstatus(conn) to check the > > status, but it doesn't use PQerrorMessage(conn) to get the error from > > the backend and string it into sqlca.sqlerrm.sqlerrmc. Is there a way > > to get that message from ECPG currently? If not, where do I file an >=20 > No, you're completely right. >=20 > > RFE, or submit a patch? >=20 > The RFE has been noted, a patch can be send to me or any other committer > of course, but I'd prefer you send it directly to me, so I can remove it > from my todo list. >=20 May I say, "ARGH!". I'm spoiled by DB2, with short simple messages and distinct error codes. I was working on a patch, but there's absolutely no way to predict the size of the PQerrorMessage() message, and I hate to send out a truncated error message. :( What may be a better idea is to provide a function (a la sqlprint) that returns the error message the backend returns. The backend error message would be stored in one field, and of course provide the same guarantees that PQerrorMessage() does (i.e., this field is susceptible to change without notice after an operation). That way, the -402 message stays the same, and interested programs could access the backend error message after receiving a non-zero return code. What would be really handy is if the back-end had a table of error codes and matching strings it used (all less than 70 chars, of course!!), instead of the nebulous CONNECTION_BAD, and hard-wired error messages... Thanks for the reply. I'll try to work on the, oh, sqlerrmsg, function. It should be relatively easy to implement. What do you think? --=20 Matthew Vanecek perl -e 'print $i=3Dpack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);' ***************************************************************************= ***** For 93 million miles, there is nothing between the sun and my shadow except= me. I'm always getting in the way of something... --=-RQx6I7hpUmHReYaLh/6r Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQA+SIEDi/CNzDSN0RIRAuABAJ0XfyLni8MyD3fVGuutAgwa3uHwfACdFjD/ p3TpQFcWBlLodRqCjt83rWQ= =u1x+ -----END PGP SIGNATURE----- --=-RQx6I7hpUmHReYaLh/6r--