Re: string variable with spaces in psql

From: Christoph Haller <ch(at)rodos(dot)fzk(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Cc: andret(dot)NOSPAM(at)atio(dot)co(dot)za
Subject: Re: string variable with spaces in psql
Date: 2003-04-04 09:21:15
Message-ID: 3E8D4E8B.1000402@rodos.fzk.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

>
> 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

Browse pgsql-sql by date

  From Date Subject
Next Message Ali Adams 2003-04-04 11:10:06 help yourself by helping others
Previous Message Manfred Koizar 2003-04-04 07:20:48 Re: More wacky grouping