Provide a test for variable existence in psql
authorAndrew Dunstan <andrew@dunslane.net>
Thu, 21 Sep 2017 23:02:23 +0000 (19:02 -0400)
committerAndrew Dunstan <andrew@dunslane.net>
Thu, 21 Sep 2017 23:02:23 +0000 (19:02 -0400)
commitd57c7a7c506276597af619bdb8c62fa5b592745a
tree6cab776216fa74f256164cbbc7859fbe1fb97b02
parent71480501057fee9fa3649b072173ff10e2b842d0
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
doc/src/sgml/ref/psql-ref.sgml
src/bin/psql/psqlscanslash.l
src/fe_utils/psqlscan.l
src/include/fe_utils/psqlscan_int.h
src/test/regress/expected/psql.out
src/test/regress/sql/psql.sql