sql - How do you use script variables in psql? - Stack Overflow
https://stackoverflow.com/questions/36959/how-do-you-use-script-variables-in-psql
WEBPostgres variables are created through the \set command, for example ... \set myvariable value. ... and can then be substituted, for example, as ... SELECT * FROM :myvariable.table1; ... or ... SELECT * FROM table1 WHERE :myvariable IS NULL; edit: As of psql 9.1, variables can be expanded in quotes as in: \set myvariable value.
DA: 53 PA: 22 MOZ Rank: 14