Re: [HACKERS] psql - add special variable to reflect the last querystatus - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: [HACKERS] psql - add special variable to reflect the last querystatus
Date
Msg-id alpine.DEB.2.20.1709112042050.8852@lancre
Whole thread Raw
In response to Re: [HACKERS] psql - add special variable to reflect the last query status  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] psql - add special variable to reflect the last query status
Re: [HACKERS] psql - add special variable to reflect the last querystatus
List pgsql-hackers
>>> I think you're overly optimistic to believe that every failure will
>>> have a SQLSTATE; I don't think that's true for libpq-reported errors,
>>> such as connection loss.
>
>> Yep, I thought I was optimistic:-) Can I add a special SQLSTATE for that
>> situation where libpq did not report an error?
>
> Meh.  If we're going to do that I think it might be better to hack
> libpq itself to do so, ie, force PQresultErrorField(..., PG_DIAG_SQLSTATE)
> to always return something.  But it seems like a hack either way.

I would not have took the liberty to hack into libpq internals for such a 
small front-end feature. However I agree that having libpq always return 
some diagnostic, even if it means "something unclear happened, sorry not 
to be very precise", would be better.

-- 
Fabien.


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: [HACKERS] Re: DROP SUBSCRIPTION hangs if sub is disabled in the sametransaction
Next
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] assorted code cleanup