]> granicus.if.org Git - postgresql/commit
Add psql variables to track success/failure of SQL queries.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 12 Sep 2017 23:27:48 +0000 (19:27 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 12 Sep 2017 23:27:48 +0000 (19:27 -0400)
commit69835bc8988812c960f4ed5aeee86b62ac73602a
tree396db4b17f3219debd841d3af6e8b1f493357506
parent6e7baa322773ff8c79d4d8883c99fdeff5bfa679
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
doc/src/sgml/ref/psql-ref.sgml
src/bin/psql/common.c
src/bin/psql/help.c
src/bin/psql/startup.c
src/test/regress/expected/psql.out
src/test/regress/sql/psql.sql