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