psql parsing and variable problems

Поиск
Список
Период
Сортировка
От Sarah Officer
Тема psql parsing and variable problems
Дата
Msg-id 38874833.9276507F@aries.tucson.saic.com
обсуждение исходный текст
Ответы Re: [GENERAL] psql parsing and variable problems
Список pgsql-general
I have been looking at the psql documentation  posted on the web
site.  I am trying to set variables, but I can't seem to make that
happen.  I also notice that psql doesn't seem to parse full
backslash commands.  Are the documents out of date, or is the a bug?

\echo foo

is interpreted as \e and pops me into the editor.

\qecho foo

is interpreted as \q and exits psql.

When I try to use a variable, psql doesn't seem to recognize it.

> create table status (
>   code varchar(5) not null,
>   stat_desc varchar(30) not null);
CREATE

> insert into status(code, stat_desc) values ('A1', 'First Status');
INSERT 19082 1

> select * from status;
code|stat_desc
----+------------
A1  |First Status
(1 row)


Following the example in the documentation, I try to set a psql
variable, but psql isn't interpreting it the way I expect it to.

>\set foo 'status'
> select * from :foo;
ERROR:  parser: parse error at or near ":"
> \set foo status
> select * from :foo;
ERROR:  parser: parse error at or near ":"

Any suggestions?  Is the posted documentation out of date?  How can
I use a psql variable?  What is the alternative?  What I really want
to do is use the 'psql --set' option so I can pass the path to the
plpgsql library from the command line.

CREATE FUNCTION plpgsql_call_handler () RETURNS OPAQUE AS
:plpgsqlpath LANGUAGE 'C';

Any help is appreciated,

Sarah Officer
officers@aries.tucson.saic.com

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

Предыдущее
От: Alex Guryanow
Дата:
Сообщение: inserting timestamp values
Следующее
От: Hitesh Patel
Дата:
Сообщение: Re: [GENERAL] weird sum() results