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