On 08/28/2014 02:46 PM, Fujii Masao wrote:
On Tue, Aug 26, 2014 at 4:55 AM, Heikki Linnakangas
<hlinnakan...@vmware.com> wrote:
On 08/25/2014 10:48 PM, Heikki Linnakangas wrote:
Actually, perhaps it would be better to just copy-paste PSQLexec, and
modify the copy to suite \watch's needs. (PSQLexecWatch?
SendWatchQuery?). PSQLexec doesn't do much, and there isn't very much
overlap between what \watch wants and what other PSQLexec callers want.
\watch wants timing output, others don't. \watch doesn't want
transaction handling.


Agreed. Attached is the revised version of the patch. I implemented
PSQLexecWatch() which sends the query, prints the results and outputs
the query execution time (if \timing is enabled).

This patch was marked as ready for committer, but since I revised
the code very much, I marked this as needs review again.

This comment:

... We use PSQLexecWatch,
!                * which is kind of cheating, but SendQuery doesn't let us 
suppress
!                * autocommit behavior.

is a bit strange now. PSQLexecWatch isn't cheating like reusing PSQLexec was; it's whole purpose is to run \watch queries.

                /*
                 * Set up cancellation of 'watch' via SIGINT.  We redo this 
each time
                 * through the loop since it's conceivable something inside 
PSQLexec
                 * could change sigint_interrupt_jmp.
                 */

This should now say "PSQLexecWatch".

Other than that, looks good to me.

- Heikki


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to