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

* string variable with spaces in psql
@ 2003-04-02 10:53 AndreT <andret.NOSPAM@atio.co.za>
  0 siblings, 0 replies; 2+ messages in thread

From: AndreT @ 2003-04-02 10:53 UTC (permalink / raw)
  To: pgsql-sql

Hi,

I need to define a variable in psql, but the variable needs to contain a
space:

This is what I want to do;

\set theName '\''John Nobody '\''
SELECT add_agent( :theName, 'Test Company', 'Test Department' );

...
etc

Unfortunately psql removes the space, so that theName = 'JohnNobody'

What do i need to do to preserve the space?

Thanks
-- 
Andre Truter

<------------------------------------------------->
< The box said: Requires Windows 95 or better...  >
< So I installed Linux                            >
<------------------------------------------------->




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

* Re: string variable with spaces in psql
@ 2003-04-04 09:21 Christoph Haller <ch@rodos.fzk.de>
  0 siblings, 0 replies; 2+ messages in thread

From: Christoph Haller @ 2003-04-04 09:21 UTC (permalink / raw)
  To: pgsql-sql; +Cc: andret.NOSPAM@atio.co.za

 >
 > I need to define a variable in psql, but the variable needs to contain a
 > space:
 >
 > This is what I want to do;
 >
 > \set theName '\''John Nobody '\''
 > SELECT add_agent( :theName, 'Test Company', 'Test Department' );
 >
 > ...
 > etc
 >
 > Unfortunately psql removes the space, so that theName = 'JohnNobody'
 >
 > What do i need to do to preserve the space?
 >
Did you try
\set theName "John Nobody "

Regards, Christoph




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


end of thread, other threads:[~2003-04-04 09:21 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-04-02 10:53 string variable with spaces in psql AndreT <andret.NOSPAM@atio.co.za>
2003-04-04 09:21 Re: string variable with spaces in psql Christoph Haller <ch@rodos.fzk.de>

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