Re: proposal - psql - possibility to redirect only tabular output - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: proposal - psql - possibility to redirect only tabular output
Date
Msg-id CAFj8pRDeT9YBCNMXhC8GFC6cdOukDsz24oGzNUtFsU0HEM0dOQ@mail.gmail.com
Whole thread Raw
In response to Re: proposal - psql - possibility to redirect only tabular output  (Erik Rijkers <er@xs4all.nl>)
Responses Re: proposal - psql - possibility to redirect only tabular output
List pgsql-hackers


so 11. 4. 2020 v 11:04 odesílatel Erik Rijkers <er@xs4all.nl> napsal:
On 2020-04-11 10:21, Pavel Stehule wrote:
> so 11. 4. 2020 v 8:54 odesílatel Pavel Stehule
> <pavel.stehule@gmail.com>
> napsal:

> [psql-status-target.patch]

Hi Pavel,

This looks interesting, and I built an instance with the patch to try
it, but I can't figure out how to use it.

Can you perhaps give a few or even just one example?

Main motivation for this patch is working with psql for writing and editing queries, and browsing result in second terminal with pspg or any other similar tool (tail, ...). The advantage of this setup is possibility to see sql and query result together. I use terminal multiplicator (Tilix), but it can be used without it.

So example with pspg (should be some fresh release)

1. create fifo used for communication - mkfifo ~/pipe

2. run in one terminal pspg - pspg -f ~/pipe --hold-stream=2

3. run psql in other terminal

psql
\o ~/pipe
CREATE TABLE foo(a int);
INSERT INTO foo VALUES(10);
-- in default case, the status row "CREATE", "INSERT" is redirected to "browser terminal" and it doesn't look well (and it is not user friendly).

with patched version you can

\set STATUS_TARGET stdout
-- after this setting, the status row will be displayed in psql terminal

Regards

Pavel





thanks!

Erik Rijkers

pgsql-hackers by date:

Previous
From: Erik Rijkers
Date:
Subject: Re: proposal - psql - possibility to redirect only tabular output
Next
From: Dilip Kumar
Date:
Subject: Re: Index Skip Scan