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

From Will Leinweber
Subject patch to add \watch to psql
Date
Msg-id CAL8LqZSE+3OC-rkG+rWFShWik=Qjw-K2zWAgjjiX0_fCwuRHhA@mail.gmail.com
Whole thread Raw
Responses Re: patch to add \watch to psql  (Abhijit Menon-Sen <ams@2ndQuadrant.com>)
Re: patch to add \watch to psql  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
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=#
Attachment

pgsql-hackers by date:

Previous
From: Jeremy Evans
Date:
Subject: Re: Always include encoding of database in pg_dumpall
Next
From: David Lee
Date:
Subject: Foreign key constraint on sub-column of composite-type column