Issue with psqlrc with command line.

Поиск
Список
Период
Сортировка
От saurabh shelar
Тема Issue with psqlrc with command line.
Дата
Msg-id CALBKi8a0XqdUjAc3nqgoukvG=P=d91zRuozx=Jwg93Ke+Hes-A@mail.gmail.com
обсуждение исходный текст
Ответы Re: Issue with psqlrc with command line.  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список 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. 

В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: using a plpgsql function argument as a table column.
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: Issue with psqlrc with command line.