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: $ 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, -- Daniel Vérité PostgreSQL-powered mailer: https://www.manitou-mail.org Twitter: @DanielVerite