I have a sql block(file.sql) as :
DO $$
DECLARE
var1 varchar;
BEGIN
var1 := :key;
END $$;
When I invoke this .sql with psql,
psql -h localhost -v key="value" -U user -f file.sql postgredb
I get an error :
ERROR: syntax error at or near ":"
Would like to know why the command line arg is not getting resolved
psqlvariables inside a PL/pgSQL block