pgsql: Add psql variables to track success/failure of SQL queries.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Add psql variables to track success/failure of SQL queries.
Date: 2017-09-12 23:28:36
Message-ID: E1drubc-0007B7-7T@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add psql variables to track success/failure of SQL queries.

This patch adds ERROR, SQLSTATE, and ROW_COUNT, which are updated after
every query, as well as LAST_ERROR_MESSAGE and LAST_ERROR_SQLSTATE,
which are updated only when a query fails. The expected usage of these
is for scripting.

Fabien Coelho, reviewed by Pavel Stehule

Discussion: https://postgr.es/m/alpine.DEB.2.20.1704042158020.12290@lancre

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/69835bc8988812c960f4ed5aeee86b62ac73602a

Modified Files
--------------
doc/src/sgml/ref/psql-ref.sgml | 44 +++++++++++++
src/bin/psql/common.c | 71 ++++++++++++++++++++
src/bin/psql/help.c | 11 +++-
src/bin/psql/startup.c | 4 ++
src/test/regress/expected/psql.out | 131 +++++++++++++++++++++++++++++++++++++
src/test/regress/sql/psql.sql | 64 ++++++++++++++++++
6 files changed, 324 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Dean Rasheed 2017-09-13 08:51:12 Re: Re: [COMMITTERS] pgsql: Use MINVALUE/MAXVALUE instead of UNBOUNDED for range partition b
Previous Message Andres Freund 2017-09-12 19:20:14 pgsql: Introduce BYTES unit for GUCs.