pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Matthew Vanecek <mevanecek@yahoo.com>
To: Michael Meskes <meskes@postgresql.org>
Cc: Postgresql Interfaces List <pgsql-interfaces@postgresql.org>
Subject: Re: Connection Error message in ECPG
Date: 10 Feb 2003 22:50:11 -0600
Message-ID: <1044939011.6526.29.camel@reliant.home.pri> (raw)
In-Reply-To: <20030210124426.GI19195@feivel.fam-meskes.de>
References: <1044733838.6526.7.camel@reliant.home.pri>
	<20030210124426.GI19195@feivel.fam-meskes.de>

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
> 
> No, you're completely right.
> 
> > RFE, or submit a patch?
> 
> 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.
> 

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?
-- 
Matthew Vanecek
perl -e 'print $i=pack(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...

Attachments:

  signature.asc (application/pgp-signature, 231B) download

view thread (3+ messages)

Message-ID: <1044939011.6526.29.camel@reliant.home.pri>
Permalink:  ../1044939011.6526.29.camel@reliant.home.pri/
Also on:    postgresql.org/message-id/1044939011.6526.29.camel@reliant.home.pri

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: mevanecek@yahoo.com, meskes@postgresql.org
  Subject: Re: Connection Error message in ECPG
  In-Reply-To: <1044939011.6526.29.camel@reliant.home.pri>

* 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