string variable with spaces in psql

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

string variable with spaces in psql

От:
"AndreT" <andret.NOSPAM@atio.co.za>
Дата:
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 <ch@rodos.fzk.de>
Дата:
 >> 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


FAQ