Re: psql > split > queries & output

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: wim(dot)bertels(at)ucll(dot)be
Cc: "pgsql-general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: psql > split > queries & output
Date: 2020-12-03 14:18:42
Message-ID: c83deef9-4cb9-4f98-bed4-093daa20f4cb@manitou-mail.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: https://www.manitou-mail.org
Twitter: @DanielVerite

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Wim Bertels 2020-12-03 15:20:12 Re: psql > split > queries & output
Previous Message Pavel Stehule 2020-12-03 12:45:05 Re: Postgres C-API: How to get the Oid for a custom type defined in a schema outside of the current search path