In postgresql, I'm psql with the -v for variable input that I can call within a sql file.
For example from bash script, it looks like this:
"$PSQL_HOME"/psql -h $HOST_NM \
-p $PORT \
-U postgres \
-v v1=$1 \
-f Test.sql
...
..
From the sql file, it looks like this:
GRANT ALL ON TABLE mytable TO mra_dev_:v1;
GRANT ALL ON TABLE mytable TO mra_dev_:v1_load;
The first statement works, but the 2nd statement fails:
psql:Test.sql:472: ERROR: syntax error at or near ":"
LINE 1: GRANT ALL ON TABLE mytable TO mra_dev_:v1_load
^
How do I get around this? Somekind of escape or concat feature I can use for this?