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

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






view thread (6+ messages)  latest in thread

Message-ID: <57e6b560f3517ef2da72b4604faabd9af36d3e9c.camel@ucll.be>
Permalink:  ../57e6b560f3517ef2da72b4604faabd9af36d3e9c.camel@ucll.be/
Also on:    postgresql.org/message-id/57e6b560f3517ef2da72b4604faabd9af36d3e9c.camel@ucll.be

 · 

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: wim.bertels@ucll.be, daniel@manitou-mail.org
  Subject: Re: psql > split > queries & output
  In-Reply-To: <57e6b560f3517ef2da72b4604faabd9af36d3e9c.camel@ucll.be>
  References: <c83deef9-4cb9-4f98-bed4-093daa20f4cb@manitou-mail.org> <57e6b560f3517ef2da72b4604faabd9af36d3e9c.camel@ucll.be>

* 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