1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-03 15:22:11 +03:00

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
This commit is contained in:
Andrew Dunstan
2017-09-21 19:02:23 -04:00
parent 7148050105
commit d57c7a7c50
6 changed files with 115 additions and 1 deletions

View File

@@ -142,5 +142,7 @@ extern char *psqlscan_extract_substring(PsqlScanState state,
extern void psqlscan_escape_variable(PsqlScanState state,
const char *txt, int len,
PsqlScanQuoteType quote);
extern void psqlscan_test_variable(PsqlScanState state,
const char *txt, int len);
#endif /* PSQLSCAN_INT_H */