pgsql: Provide a test for variable existence in psql

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Provide a test for variable existence in psql
Date: 2017-09-21 23:11:44
Message-ID: E1dvAdE-0007yW-2Z@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Provide a test for variable existence in psql

"\if :{?variable_name}" will be translated to "\if TRUE" if the variable
exists and "\if FALSE" otherwise. Thus it will be possible to execute code
conditionally on the existence of the variable, regardless of its value.

Fabien Coelho, with some review by Robins Tharakan and some light text
editing by me.

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d57c7a7c506276597af619bdb8c62fa5b592745a

Modified Files
--------------
doc/src/sgml/ref/psql-ref.sgml | 10 +++++++++
src/bin/psql/psqlscanslash.l | 18 ++++++++++++++++
src/fe_utils/psqlscan.l | 42 ++++++++++++++++++++++++++++++++++++-
src/include/fe_utils/psqlscan_int.h | 2 ++
src/test/regress/expected/psql.out | 26 +++++++++++++++++++++++
src/test/regress/sql/psql.sql | 18 ++++++++++++++++
6 files changed, 115 insertions(+), 1 deletion(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2017-09-22 02:37:38 Re: [HACKERS] Re: pgsql: Make new crash restart test a bit more robust.
Previous Message Tom Lane 2017-09-21 22:13:56 pgsql: Give a better error for duplicate entries in VACUUM/ANALYZE colu