Re: redirecting query statement and output to a marked up file, using psql

Поиск
Список
Период
Сортировка
От Bosco Rama
Тема Re: redirecting query statement and output to a marked up file, using psql
Дата
Msg-id 4D4C3B6F.7010508@boscorama.com
обсуждение исходный текст
Ответ на Re: redirecting query statement and output to a marked up file, using psql  (Wim Bertels <wim.bertels@khleuven.be>)
Список pgsql-general
Wim Bertels wrote:
>
> \qecho doenst interpret parameters it just echo text, in this case 'ECHO
> queries'

Seems like you had two problems and I didn't see any reference to the second
one initially.  The first was the output of \echo going to the wrong place
which is fixed by using \qecho.

The second problem is that you are looking to have the variable 'ECHO' replaced
in the \qecho command with its current value.  This is done using the variable
substitution syntax (i.e. the variable name within a pair of colons) like this:
   \set ECHO Hello
   \o testfile.txt
   \qecho :ECHO: world
   \q

Will cause the testfile.txt file to have a line that reads:
   Hello world

HTH

Bosco.

В списке pgsql-general по дате отправления:

Предыдущее
От: Bob Price
Дата:
Сообщение: Re: how to avoid repeating expensive computation in select
Следующее
От: Carlos Mennens
Дата:
Сообщение: Remove Role Membership