Re: psql - add special variable to reflect the last query status

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql - add special variable to reflect the last query status
Date: 2017-09-05 18:08:11
Message-ID: 7870.1504634891@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> writes:
>> * It might be better if SQLSTATE and ERROR_MESSAGE were left
>> unchanged by a non-error query.

> Hmmm. I'm not sure. If so, ERROR_MESSAGE should be LAST_ERROR_MESSAGE
> maybe? Then what about LAST_ERROR_SQLSTATE to go with it, and let SQLSTATE
> & ERROR_MESSAGE reflect the last command, and ERROR is just the boolean to
> test if it occured?

>> That would reduce the need to copy them into other variables just
>> because you needed to do something else before printing them. It'd save
>> a few cycles too.

> Well, my suggestion would mean that they would be copied when an error
> occurs, but only when it occurs, which would not be often.

Uh ... what?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jesper Pedersen 2017-09-05 18:09:19 Re: Fix performance of generic atomics
Previous Message Fabien COELHO 2017-09-05 18:00:22 Re: psql - add special variable to reflect the last query status