pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
quoted variables in pgsql
2+ messages / 2 participants
[nested] [flat]

* quoted variables in pgsql
@ 2007-01-05 03:21  chester c young <chestercyoung@yahoo.com>
  0 siblings, 1 reply; 2+ messages in thread

From: chester c young @ 2007-01-05 03:21 UTC (permalink / raw)
  To: pgsql-sql

cannot figure this out

# \set var 'value'
# select * from some_table where some_col = :var;
ERROR: column value does not exist

cannot get those quotes around the value.  tried:
# \set var ''value''
# \set var ''''value''''

in each case:
# \echo :var
value

thanks

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: quoted variables in pgsql
@ 2007-01-05 03:26  Tom Lane <tgl@sss.pgh.pa.us>
  parent: chester c young <chestercyoung@yahoo.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2007-01-05 03:26 UTC (permalink / raw)
  To: chester c young <chestercyoung@yahoo.com>; +Cc: pgsql-sql

chester c young <chestercyoung@yahoo.com> writes:
> cannot get those quotes around the value.

Use backslashes.

regression=# \set var '\'value\''
regression=# \echo :var
'value'

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2007-01-05 03:26 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-01-05 03:21 quoted variables in pgsql chester c young <chestercyoung@yahoo.com>
2007-01-05 03:26 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox