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

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql - add special variable to reflect the last query status
Date: 2017-04-04 21:01:10
Message-ID: CAFj8pRAJSxuiagCaiR5jPvouB21oXOPbWd+oTOe4hd0JD-3j-w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2017-04-04 22:05 GMT+02:00 Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>:

>
> After some discussions about what could be useful since psql scripts now
> accepts tests, this patch sets a few variables which can be used by psql
> after a "front door" (i.e. actually typed by the user) query:
>
> - RESULT_STATUS: the status of the query
> - ERROR: whether the query failed
> - ERROR_MESSAGE: ...
> - ROW_COUNT: #rows affected
>
> SELECT * FROM ;
> \if :ERROR
> \echo oops
> \q
> \endif
>
> I'm not sure that the names are right. Maybe STATUS would be better than
> RESULT_STATUS.

good ideas

Regards

Pavel

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2017-04-04 21:18:26 Re: PATCH: recursive json_populate_record()
Previous Message Peter Geoghegan 2017-04-04 20:49:11 Re: tuplesort_gettuple_common() and *should_free argument