I have a scenario like below with Postgres 9.4.5:
CREATE OR REPLACE FUNCTION something(varA text) RETURNS void AS $$
BEGIN
...
RAISE INFO '%',varA;
END;
$$
LANGUAGE plpgsql;
DO
$$
declare
varA text := :cmd_line_arg;
begin
perform something(varA);
end;
$$
All this resides in some file plpgsql.sql
and is executed like so:
psql -v cmd_line_arg='value' -U postgres -d postgres -f plpgsql.sql
I receive syntax error at or near
':'
I have also found errors when using the string concatenation operator ||
.
What am I missing here? Is it something to do with the DO
?
NOTE: This link did not help.