Hi All,

I am facing issue while executing psqlrc alias commands via. "psql -c"
option.

Please find below details:

-bash-4.2$ cat .psqlrc
\set testing 'select * from test;'

postgres=# select version();
                                                 version

----------------------------------------------------------------------------------------------------------
 PostgreSQL 9.6.2 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.4.7
20120313 (Red Hat 4.4.7-16), 64-bit
(1 row)

*postgres=# :testing*
 id
----
  1

However, it is not working with the command line.

*-bash-4.2$ /opt/PostgreSQL/9.6/bin/psql -c ":testing"*
ERROR:  syntax error at or near ":" at character 1
STATEMENT:  :testing
ERROR:  syntax error at or near ":"
LINE 1: :testing

As per the document from PG-9.6 it is possible.

Apologies, If I am getting wrong.

Reply via email to