On Thu, Dec 06, 2018 at 05:01:26AM -0300, Alvaro Herrera 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
Hi Álvaro,
> On 6. Dec 2018, at 13:56, Alvaro Herrera wrote:
>
> 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 \w
Alvaro Herrera wrote:
> Hmm, thanks. AFAICS your hack reexecutes the initial query over and
> over, instead of obtaining a fresh query each time.
I see. That hack is about injecting something programmatically
into the query buffer, but it seems you'd need to do that in a loop.
And if psq
On 2018-Dec-06, Daniel Verite wrote:
> I think you could achieve more or less the result with a pre-gexec
> hack like that:
Hmm, thanks. AFAICS your hack reexecutes the initial query over and
over, instead of obtaining a fresh query each time.
--
Álvaro Herrerahttps://www.2ndQu
Alvaro Herrera wrote:
> 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 can of course solve my problem with a simple python program, but psql
> is
y 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 | 2
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
e', 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 wil
ther 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_ti
7;, 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
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 wo
> That is:
>
> =# select 'select now()' \gexec \watch
> 2018-12-05 19:46:04.928995-03
>
> select now()
>
> select now()
>
> select now()
>
> (This is under \pset tuples_only)
>
> I think to be really useful, this combination ought to work lik
I just noticed that using \watch after \gexec does not do what I would
like it to do, namely re-execute the returned queries. Instead, it
executes the returned queries once, then it just returns the queries.
That is:
=# select 'select now()' \gexec \watch
2018-12-05 19:46:04.928995-0
13 matches
Mail list logo