Re: proposal - psql - possibility to redirect only tabular output

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Erik Rijkers <er(at)xs4all(dot)nl>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal - psql - possibility to redirect only tabular output
Date: 2020-04-11 09:19:19
Message-ID: CAFj8pRDeT9YBCNMXhC8GFC6cdOukDsz24oGzNUtFsU0HEM0dOQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

so 11. 4. 2020 v 11:04 odesílatel Erik Rijkers <er(at)xs4all(dot)nl> napsal:

> On 2020-04-11 10:21, Pavel Stehule wrote:
> > so 11. 4. 2020 v 8:54 odesílatel Pavel Stehule
> > <pavel(dot)stehule(at)gmail(dot)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
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2020-04-11 09:47:25 Re: Index Skip Scan
Previous Message Erik Rijkers 2020-04-11 09:04:21 Re: proposal - psql - possibility to redirect only tabular output