Re: Check psql parameter is passed, if not ask for it

2024-08-05 Thread Torsten Förtsch
to quote the documentation: > If an unquoted colon (:) followed by a psql variable name appears within an argument, it is replaced by the variable's value, as described in SQL Interpolation below. > The forms :'variable_name' and :"variable_name" described there work as well. The :{?variable_name}

Check psql parameter is passed, if not ask for it

2024-08-05 Thread Wiwwo Staff
Hi! I want to check if I pass the parameter "param1" to a sql script "delme.sql" like ``` \if ':param1' \echo :param1; \else \prompt 'Param1? ' :param1 \endif select :'param1'; ``` if parameter `param1` is not passed, the .sql should ask for it. If I run something like `psql -f delme.sql -v pa