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

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Fabien COELHO <coelho@cri.ensmp.fr>, Pavel Stehule <pavel.stehule@gmail.com>, PostgreSQL Developers <pgsql-hackers@postgresql.org>
Date: 2017-09-12T19:22:10Z
Lists: pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> Well, if we provided a different SQLSTATE for each qualitatively
> different type of libpq error, that might well be useful enough to
> justify some risk of application breakage.  But replacing a constant
> string that we've had for ~15 years with a different constraint string
> isn't doing anything about the lack-of-information problem you're
> complaining about.

True.  Well, the original point here was whether psql ought to be doing
something to mask libpq's (mis) behavior.  I'm inclined to think not:
if it doesn't get a SQLSTATE from the PGresult, it should just set the
sqlstate variables to empty strings.

			regards, tom lane


Commits

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