Re: \gexec \watch

2018-12-06 Thread David Fetter
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

Re: \gexec \watch

2018-12-06 Thread Oleksii Kliukin
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

Re: \gexec \watch

2018-12-06 Thread Daniel Verite
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

Re: \gexec \watch

2018-12-06 Thread Alvaro Herrera
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

Re: \gexec \watch

2018-12-06 Thread Daniel Verite
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

Re: \gexec \watch

2018-12-06 Thread Pavel Stehule
čt 6. 12. 2018 v 13:56 odesílatel Alvaro Herrera napsal: > On 2018-Dec-06, Pavel Stehule wrote: > > > čt 6. 12. 2018 v 12:26 odesílatel Oleksii Kliukin > > napsal: > > > > The other question is whether such a command would execute the original > > > query every time watch is invoked. Consider, e

Re: \gexec \watch

2018-12-06 Thread Alvaro Herrera
On 2018-Dec-06, Pavel Stehule wrote: > čt 6. 12. 2018 v 12:26 odesílatel Oleksii Kliukin > 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

Re: \gexec \watch

2018-12-06 Thread Alvaro Herrera
Hi Oleksii On 2018-Dec-06, Oleksii Kliukin wrote: > 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 > execu

Re: \gexec \watch

2018-12-06 Thread Pavel Stehule
čt 6. 12. 2018 v 12:26 odesílatel Oleksii Kliukin napsal: > > > > On 6. Dec 2018, at 09:01, 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 ma

Re: \gexec \watch

2018-12-06 Thread Oleksii Kliukin
> On 6. Dec 2018, at 09:01, 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 another? >

Re: \gexec \watch

2018-12-06 Thread Alvaro Herrera
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

Re: \gexec \watch

2018-12-05 Thread David Fetter
On Wed, Dec 05, 2018 at 07:50:23PM -0300, Alvaro Herrera wrote: > 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: > > =# s