> On 6. Dec 2018, at 09:01, Alvaro Herrera <alvhe...@2ndquadrant.com> wrote:
> 
> On 2018-Dec-06, David Fetter wrote:
> 
>> There's a bit of a philosophical issue here, or a mathematical one,
>> whichever way you want to put it.  Does it actually make sense to have
>> the behavior of one "semicolon" spill onto another?
> 
> Honestly, I don't see the mathematicality in this.  It either works, or
> it doesn't -- and from my POV right now it doesn't.  Are you saying we
> need a \gexecwatch for this to work?

I’ve been trying to do similar stuff with periodic execution of \gexec 
(changing the tablespace of all tables in the given one and retrying, since 
some of them could only get a lock on subsequent attempts)  and generally 
reverted to a  bash loop outside of psql, but having it built-in would be great.

Perhaps a numeric argument to \gexec, i.e. \gexec 5 to re-execute the output of 
a query every 5 seconds?

The other question is whether such a command would execute the original query 
every time watch is invoked. Consider, e.g. the following one:

select format('select now() as execution_time, %L as generation_time', now()) 
\gexec
execution_time  | 2018-12-06 12:15:24.136086+01
generation_time | 2018-12-06 12:15:24.13577+01

If we make \gexec + \watch combination re-execute only the output of the 
original query (without the query itself), then the generation time column will 
stay constant through all \watch invocations.

Cheers,
Oleksii

Reply via email to