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

From: Bosco Rama <postgres(at)boscorama(dot)com>
To: Wim Bertels <wim(dot)bertels(at)khleuven(dot)be>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: redirecting query statement and output to a marked up file, using psql
Date: 2011-02-04 11:23:10
Message-ID: 4D4BE19E.8040908@boscorama.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Wim Bertels wrote:
> On Wed, 2011-02-02 at 12:49 -0800, Bosco Rama wrote:
>> Wim Bertels wrote:
>> >
>> > --user2
>> > SET SESSION AUTHORIZATION user2;
>> > \pset format latex
>> > \echo ECHO queries
>> > \o report/test_user2.tex
>> > \i structure/test_user2.sql
>> > "
>> >
>> > This doenst seem to work,
>> > as the ECHO queries output isnt written to the file (test_user2.tex)
>>
>> Actions are performed as they are encountered so put the \echo *after* the
>> \o, like this:
>>
>> SET SESSION AUTHORIZATION user2;
>> \pset format latex
>> \o report/test_user2.tex
>> \echo ECHO queries
>> \i structure/test_user2.sql
>
> Hallo Bosco,
>
> i tried changing that, but it doesnt seem to work
> (the echo only affects the psql cmdl, but is not written to /o file)

Apologies, Wim. I meant to also indicate that you need to use the \qecho
command. It echoes to the query output stream whereas \echo echoes to the
stdout. So you would use:
\qecho ECHO queries

instead of the \echo above.

Hopefully I didn't forget anything else this time. :-)

HTH

Bosco.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Wim Bertels 2011-02-04 11:28:11 Re: redirecting query statement and output to a marked up file, using psql
Previous Message Wim Bertels 2011-02-04 09:29:01 Re: redirecting query statement and output to a marked up file, using psql