Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux