Re: Add schema-qualified relnames in constraint error messages. - Mailing list pgsql-hackers

From Shulgin, Oleksandr
Subject Re: Add schema-qualified relnames in constraint error messages.
Date
Msg-id CACACo5RNXQw-r0XNEH7npSj_bQhGJ23PmEX+VxTyr4qq2L_A5g@mail.gmail.com
Whole thread Raw
In response to Re: Add schema-qualified relnames in constraint error messages.  ("Daniel Verite" <daniel@manitou-mail.org>)
Responses Re: Add schema-qualified relnames in constraint error messages.
List pgsql-hackers
On Wed, Feb 10, 2016 at 12:33 AM, Daniel Verite <daniel@manitou-mail.org> wrote:
        Shulgin, Oleksandr wrote:

> Most importantly, I'd like to learn of better options than storing the
> whole last_result in psql's pset structure.

I guess that you could, each time a query fails, gather silently the
result of \errverbose, store it in a buffer, discard the PGresult,
and in case the user does \errverbose before running another query,
output what was in that buffer.

That's a neat idea.  I also think that we could only store last PGresult when the query fails actually and discard it otherwise: the PGresult holding only the error doesn't occupy too much space.

What I dislike about this POC is all the disruption in libpq, to be honest.  It would be much neater if we could form the verbose message every time and let the client decide where to cut it.  Maybe a bit "too clever" would be to put a \0 char between short message and it's verbose continuation.  The client could then reach the verbose part like this (assuming that libpq did put a verbose part there): msg + strlen(msg) + 1.

--
Alex

pgsql-hackers by date:

Previous
From: Ashutosh Bapat
Date:
Subject: Re: Re: [COMMITTERS] pgsql: Only try to push down foreign joins if the user mapping OIDs mat
Next
From: Amit Langote
Date:
Subject: Re: [PROPOSAL] VACUUM Progress Checker.