redirecting query statement and output to a marked up file, using psql - Mailing list pgsql-general

From Wim Bertels
Subject redirecting query statement and output to a marked up file, using psql
Date
Msg-id 1296657663.2171.9.camel@zwerfkat
Whole thread Raw
Responses Re: redirecting query statement and output to a marked up file, using psql
List pgsql-general
Hallo,

goal:
to write the input and query results to different files in 1 script

context example:
1 sql script demo.sql
"
--init messaging
\set client_min_messages warning
\set log_error_verbosity terse

--user1
SET SESSION AUTHORIZATION user1;
\pset format html
\o report/test_user1.html
\i structure/test_user1.sql

--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)

The only work around i found so far,
is using redirection.
starting for example
> psql -L out.txt  # only txt markup
or
> psql > out.txt
But then if have to postprocess the out.txt file, dividing it into
several different files, and the format/markup doenst work so nice any
more.

Suggestions?

tnx,
Wim


pgsql-general by date:

Previous
From: Ahmed
Date:
Subject: Re: "could not accept SSPI security context"
Next
From: Tom Lane
Date:
Subject: Re: Hot-Standby and sequences