Skip site navigation (1) Skip section navigation (2)

Re: psql questions

From: "Walker, Jed S" <Jed_Walker(at)cable(dot)comcast(dot)com>
To: 'John DeSoi' <desoi(at)pgedit(dot)com>
Cc: "'pgsql-novice(at)postgresql(dot)org'" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: psql questions
Date: 2005-03-25 15:23:26
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
Hi John,

Thanks, I had tried the semi-colon, it's the unusual quoting syntax I was

\set '/'jed\''
select :jed;

Is that the only way you can quote it to make a string work?

-----Original Message-----
From: John DeSoi [mailto:desoi(at)pgedit(dot)com]
Sent: Thursday, March 24, 2005 5:07 PM
To: Walker, Jed S
Cc: 'pgsql-novice(at)postgresql(dot)org'
Subject: Re: [NOVICE] psql questions

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 

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

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

\set myint 37

select :myint + 10;
(1 row)

John DeSoi, Ph.D.
Power Tools for PostgreSQL


pgsql-novice by date

Next:From: Michelle KonzackDate: 2005-03-25 15:48:50
Subject: Re: install pgaccess under windows xp
Previous:From: John DeSoiDate: 2005-03-25 13:52:00
Subject: Re: stored procedures?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group