Add psql variables to track success/failure of SQL queries.
Tom Lane <tgl@sss.pgh.pa.us>
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
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/ref/psql-ref.sgml | modified | +44 −0 |
| src/bin/psql/common.c | modified | +71 −0 |
| src/bin/psql/help.c | modified | +10 −1 |
| src/bin/psql/startup.c | modified | +4 −0 |
| src/test/regress/expected/psql.out | modified | +131 −0 |
| src/test/regress/sql/psql.sql | modified | +64 −0 |
Documentation touched
Discussion
- psql - add special variable to reflect the last query status 40 messages · 2017-04-04 → 2017-09-13