čt 6. 12. 2018 v 13:56 odesílatel Alvaro Herrera <alvhe...@2ndquadrant.com>
napsal:

> On 2018-Dec-06, Pavel Stehule wrote:
>
> > čt 6. 12. 2018 v 12:26 odesílatel Oleksii Kliukin <al...@hintbits.com>
> > napsal:
>
> > > 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.
> >
> > It is better to introduce new command like \gexec_repeat with units like
> > 5s, or how much 5x -
>
> It is?  \gexec \watch is an elegant construct using two existing atoms
> with well-defined semantics.  Can't say I see that in \gexec_repeat --
> it seems non-orthogonal to me.
>

Maybe I am wrong, but currently is not possible to compose \ commands.

So you should to introduce new pattern. There is enough long command buffer
to implement it.

Regards

Pavel


> To Oleksii's question, I think if you want to repeat the first query
> over and over, you'd use something like this:
>
> select format('select now() as execution_time, %L as generation_time',
> now()) as query \gset
> :query \watch
>
> --
> Álvaro Herrera                https://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
>

Reply via email to