Daniel Verite schreef op do 03-12-2020 om 16:32 [+0100]:
> Wim Bertels wrote:
>
> > but interactively this doesn't seem to work
>
> Interactively something like this might do the job:
>
> $ PSQL_HISTORY=/tmp/queries.txt psql -L /tmp/logfile.txt
>
> After running some queries, and a clean exit from psql:
yes indeed,
but as i mentioned in the beginning,
i can't consult the current history in a side pane,
only with option /s
(while still running the psql session)
(side note:
$ echo $PSQL_HISTORY (is empty)
$ psql
psql (12.5 (Debian 12.5-1.pgdg100+1))
Type "help" for help.
# \set HISTFILE /tmp/test
# select 1;
has no effect, /tmp/test is not created,
everything is put into ~.psql_history )
(debian specific?, intended?, or bug?)
>
> $ cat /tmp/queries.txt
> select 1;
> select 2;
>
>
> $ cat /tmp/logfile.txt
> ********* QUERY **********
> select 1;
> **************************
>
> ?column?
> ----------
> 1
> (1 row)
>
> ********* QUERY **********
> select 2;
> **************************
>
> ?column?
> ----------
> 2
> (1 row)
>
>
> Best regards,
--
mvg,
Wim
--
https://coronalert.be
--
In India, "cold weather" is merely a conventional phrase and has come into
use through the necessity of having some way to distinguish between weather
which will melt a brass door-knob and weather which will only make it mushy.
-- Mark Twain