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

From: Wim Bertels <wim(dot)bertels(at)khleuven(dot)be>
To: Bosco Rama <postgres(at)boscorama(dot)com>
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 09:29:01
Message-ID: 1296811741.2001.17.camel@zwerfkat
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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)

i am using a buil script, eg

psql -f init/test_build_psql.sql dev
or in psql> \i init/test_build_psql.sql

with the contents of test_build_psql.sql being:
"
\set client_min_messages warning
\set log_error_verbosity terse

SET SESSION AUTHORIZATION user1;

\i init/test_create.sql
\i init/test_insert.sql

SET SESSION AUTHORIZATION userX;

\i init/test_grant.sql
\i functions/Trigger_functions.sql

SET SEARCH_PATH TO s1, s2, s3, s4;

--functions report
\pset format html
\o report/functions_report.html
\df

--test student
\o report/test_student.html
\set ECHO queries
\i init/test_student_try_out.sql

--undo some settings
\pset format aligned
\set ECHO
\o

\set client_min_messages notice
\set log_error_verbosity verbose
"

mvg,
Wim

>
> HTH,
> Bosco.
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bosco Rama 2011-02-04 11:23:10 Re: redirecting query statement and output to a marked up file, using psql
Previous Message pasman pasmański 2011-02-04 05:57:45 Re: isn't "insert into where not exists" atomic?