Обсуждение: string variable with spaces in psql

Поиск
Список
Период
Сортировка

string variable with spaces in psql

От
"AndreT"
Дата:
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                            >
<------------------------------------------------->



Re: string variable with spaces in psql

От
Christoph Haller
Дата:
>> I need to define a variable in psql, but the variable needs to contain a> space:>> This is what I want to do;>>
\settheName '\''John Nobody '\''> SELECT add_agent( :theName, 'Test Company', 'Test Department' );>> ...> etc>>
Unfortunatelypsql 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