Re: psql questions

From: John DeSoi <desoi(at)pgedit(dot)com>
To: "Walker, Jed S" <Jed_Walker(at)cable(dot)comcast(dot)com>
Cc: "'pgsql-novice(at)postgresql(dot)org'" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: psql questions
Date: 2005-03-25 00:07:03
Message-ID: D0E42022-9CC1-11D9-A708-000A95B03262@pgedit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


On Mar 24, 2005, at 6:29 PM, Walker, Jed S wrote:

> How can do those things in psql? (I found the \set which seems to
> work, no
> error, but I can't figure out how to use the variable in a psql
> session)

You prefix the variable with a colon to get the value. Here are a few
examples:

\set mystring '\'here is a string\''

select :mystring || ' test';
?column?
----------------------
here is a string test
(1 row)

\set myint 37

select :myint + 10;
?column?
----------
47
(1 row)

John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message luckydavid 2005-03-25 06:10:14 install pgaccess under windows xp
Previous Message Walker, Jed S 2005-03-24 23:29:53 psql questions