patch to add \watch to psql
Will Leinweber <will@heroku.com>
From: Will Leinweber <will@heroku.com>
To: Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2012-10-20T00:15:27Z
Lists: pgsql-hackers
Attachments
- psql-watch-v1.patch (application/octet-stream) patch v1
This patch adds \watch to psql. It is much like the unix equivalent,
defaulting to every 2 seconds, and allowing you optionally specify a number
of seconds.
I will add this to the commit fest app.
Thanks,
Will Leinweber
Example:
psql (9.3devel, server 9.1.4)
Type "help" for help.
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)
Watch every 2s Fri Oct 19 17:09:25 2012
now
-------------------------------
2012-10-19 17:09:25.745125-07
(1 row)
Watch every 2s Fri Oct 19 17:09:27 2012
now
-------------------------------
2012-10-19 17:09:27.746732-07
(1 row)
^Cwill=# \watch 5 select now();
Watch every 5s Fri Oct 19 17:09:33 2012
now
-------------------------------
2012-10-19 17:09:33.563695-07
(1 row)
Watch every 5s Fri Oct 19 17:09:38 2012
now
-------------------------------
2012-10-19 17:09:38.564802-07
(1 row)
^Cwill=# \watch select pg_sleep(20);
^CCancel request sent
ERROR: canceling statement due to user request
will=#