Re: patch to add \watch to psql - Mailing list pgsql-hackers

From Abhijit Menon-Sen
Subject Re: patch to add \watch to psql
Date
Msg-id 20121020071903.GA21485@toroid.org
Whole thread Raw
In response to patch to add \watch to psql  (Will Leinweber <will@heroku.com>)
Responses Re: patch to add \watch to psql  (Daniel Farina <daniel@heroku.com>)
List pgsql-hackers
At 2012-10-19 17:15:27 -0700, will@heroku.com wrote:
>
> will=# \watch select now();
> Watch every 2s Fri Oct 19 17:09:23 2012
>
>               now
> -------------------------------
>  2012-10-19 17:09:23.743176-07
> (1 row)

The patch looks OK at first glance, and I can confirm that it works as
intended. I can imagine this functionality being useful, e.g. to watch
pg_stat_activity or similar tables.

But a big part of why watch(1) is nice is that the output is overwritten
rather than scrolling. When it's scrolling, it's (a) difficult to notice
that something has changed, and (b) harder to compare values, especially
when the interval is short.

For these reasons, I can imagine using "watch -n2 psql -c …", but not
\watch in its present form. (Of course, I doubt anyone would be enthused
about a proposal to link ncurses into psql, but that's another matter.)

Maybe you should call it \repeat or something. I'm sure people would get
around to using \watch that way eventually. :-)

-- Abhijit



pgsql-hackers by date:

Previous
From: David Lee
Date:
Subject: Foreign key constraint on sub-column of composite-type column
Next
From: Kohei KaiGai
Date:
Subject: Re: Move postgresql_fdw_validator into dblink