pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Verite <daniel@manitou-mail.org>
To: wim.bertels@ucll.be
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: psql > split > queries & output
Date: Thu, 03 Dec 2020 15:18:42 +0100
Message-ID: <c83deef9-4cb9-4f98-bed4-093daa20f4cb@manitou-mail.org> (raw)
In-Reply-To: <73c574f0b615a1bff6d6ce48f7ba520a7bd749d5.camel@ucll.be>

	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





view thread (6+ messages)  latest in thread

Message-ID: <c83deef9-4cb9-4f98-bed4-093daa20f4cb@manitou-mail.org>
Permalink:  ../c83deef9-4cb9-4f98-bed4-093daa20f4cb@manitou-mail.org/
Also on:    postgresql.org/message-id/c83deef9-4cb9-4f98-bed4-093daa20f4cb@manitou-mail.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: daniel@manitou-mail.org, wim.bertels@ucll.be
  Subject: Re: psql > split > queries & output
  In-Reply-To: <c83deef9-4cb9-4f98-bed4-093daa20f4cb@manitou-mail.org>
  References: <73c574f0b615a1bff6d6ce48f7ba520a7bd749d5.camel@ucll.be> <c83deef9-4cb9-4f98-bed4-093daa20f4cb@manitou-mail.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox