Issue with psqlrc with command line.

From: saurabh shelar <saurabhshelar5(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Issue with psqlrc with command line.
Date: 2018-08-29 15:07:59
Message-ID: CALBKi8a0XqdUjAc3nqgoukvG=P=d91zRuozx=Jwg93Ke+Hes-A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2018-08-29 15:13:58 Re: Issue with psqlrc with command line.
Previous Message Adrian Klaver 2018-08-29 13:40:06 Re: using a plpgsql function argument as a table column.