wrong:
pavel@nemesis ~]$ psql postgres -v x=3D10 -c "select :x"
ERROR: syntax error at or near ":"
LINE 1: select :x
^
good (workaround):
[pavel@nemesis ~]$ echo 'select :x' | psql postgres -v x=3D10
?column?
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80
10
(1 row)
psql have to have process external variables first and then execute query.
Regards
Pavel Stehule