Re: psql > split > queries & output

From: Wim Bertels <wim(dot)bertels(at)ucll(dot)be>
To: Daniel Verite <daniel(at)manitou-mail(dot)org>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: psql > split > queries & output
Date: 2020-12-03 15:20:12
Message-ID: 57e6b560f3517ef2da72b4604faabd9af36d3e9c.camel@ucll.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Daniel Verite schreef op do 03-12-2020 om 15:18 [+0100]:
> Wim Bertels wrote:
>
> > * one pipe (or..) to a file which only contains the statements
> > (queries) history (and not the output)
> > * another pipe (or..) to a file which only contains the output
> > (with or
> > without the statements) history
>
> Consider that script:
>
> $ cat f.sql
> \set ECHO queries
> \o output.txt
> select 1;
> select 2;
> select 3;
>
> If it's run with
>
> $ psql -f f.sql >queries.txt
>
> then it produces the queries in queries.txt and the output in
> output.txt

thank you,
i use the same with a input file,
but interactively this doesn't seem to work

ie
psql > queries.txt (does not work (stdout))
(psql 2> queries.txt does work (stderr))
(psql &> queries.txt does not work (both))

--

psql -f - > out

does work interactively,
but no fun experience :) (no completion, and the separation does not
seem to work)

>
>
> Best regards,
--
mvg,
Wim
--
https://coronalert.be

--
If you laid all of our laws end to end, there would be no end.
-- Mark Twain

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Daniel Verite 2020-12-03 15:32:11 Re: psql > split > queries & output
Previous Message Daniel Verite 2020-12-03 14:18:42 Re: psql > split > queries & output