psql parsing and variable problems

From: Sarah Officer <officers(at)aries(dot)tucson(dot)saic(dot)com>
To: pgsql-general(at)postgreSQL(dot)org
Subject: psql parsing and variable problems
Date: 2000-01-20 17:38:59
Message-ID: 38874833.9276507F@aries.tucson.saic.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)aries(dot)tucson(dot)saic(dot)com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Hitesh Patel 2000-01-20 18:03:21 Re: [GENERAL] weird sum() results
Previous Message Alex Guryanow 2000-01-20 17:33:01 inserting timestamp values