Re: Allow default \watch interval in psql to be configured

2025-04-05 Thread Greg Sabino Mullane
On Thu, Mar 20, 2025 at 4:45 PM Daniel Gustafsson wrote: > Having a watch interval of zero is IMHO somewhat nonsensical, but since it > was done intentionally in 6f9ee74d45 (which I had missed) I agree that the > default should support it as well. Fixed. > Yeah, I forgot about that too. The new

Re: Allow default \watch interval in psql to be configured

2025-04-04 Thread Daniel Gustafsson
> On 17 Mar 2025, at 13:37, Ashutosh Bapat wrote: > 0 is an accepted value for interval, even though it might look insensible. > > The behaviour should be same in both cases \watch i= and > \set WATCH_INTERVAL \watch. In this case it's not. Having a watch interval of zero is IMHO somewhat nons

Re: Allow default \watch interval in psql to be configured

2025-04-04 Thread Pavel Stehule
st 26. 3. 2025 v 13:24 odesílatel Daniel Gustafsson napsal: > > On 26 Mar 2025, at 10:12, Pavel Stehule wrote: > > > yes, it is ok after this change > > Thanks for confirming, committed. > Thank you Pavel > > -- > Daniel Gustafsson > >

Re: Allow default \watch interval in psql to be configured

2025-03-27 Thread Daniel Gustafsson
> On 27 Mar 2025, at 14:04, Ranier Vilela wrote: > > Hi. > > Em qua., 26 de mar. de 2025 às 09:24, Daniel Gustafsson > escreveu: > > On 26 Mar 2025, at 10:12, Pavel Stehule wrote: > > > yes, it is ok after this change > > Thanks for confirming, committed. > Per Coverity. > > I think that c

Re: Allow default \watch interval in psql to be configured

2025-03-27 Thread Ranier Vilela
Hi. Em qua., 26 de mar. de 2025 às 09:24, Daniel Gustafsson escreveu: > > On 26 Mar 2025, at 10:12, Pavel Stehule wrote: > > > yes, it is ok after this change > > Thanks for confirming, committed. > Per Coverity. I think that commit 1a759c8 lef

Re: Allow default \watch interval in psql to be configured

2025-03-26 Thread Daniel Gustafsson
> On 26 Mar 2025, at 10:12, Pavel Stehule wrote: > yes, it is ok after this change Thanks for confirming, committed. -- Daniel Gustafsson

Re: Allow default \watch interval in psql to be configured

2025-03-26 Thread Pavel Stehule
st 26. 3. 2025 v 9:05 odesílatel Daniel Gustafsson napsal: > > On 26 Mar 2025, at 08:42, Pavel Stehule wrote: > > > The reason is probably my LANG=cs_CZ.UTF8. When I switched to LANG=C, > then tests passed. > > > > The main problem is in numeric format. Czech uses the comma instead of > the dot.

Re: Allow default \watch interval in psql to be configured

2025-03-26 Thread Daniel Gustafsson
> On 26 Mar 2025, at 08:42, Pavel Stehule wrote: > The reason is probably my LANG=cs_CZ.UTF8. When I switched to LANG=C, then > tests passed. > > The main problem is in numeric format. Czech uses the comma instead of the > dot. Thanks for investigating! The main value of the test is to test

Re: Allow default \watch interval in psql to be configured

2025-03-26 Thread Pavel Stehule
st 26. 3. 2025 v 7:59 odesílatel Pavel Stehule napsal: > Hi > > út 25. 3. 2025 v 20:09 odesílatel Daniel Gustafsson > napsal: > >> > On 24 Mar 2025, at 13:42, Ashutosh Bapat >> wrote: >> >> > LGTM. I think this is RFC. Updated CF entry. >> >> Thanks all for review, committed. >> >> > regress te

Re: Allow default \watch interval in psql to be configured

2025-03-26 Thread Pavel Stehule
Hi út 25. 3. 2025 v 20:09 odesílatel Daniel Gustafsson napsal: > > On 24 Mar 2025, at 13:42, Ashutosh Bapat > wrote: > > > LGTM. I think this is RFC. Updated CF entry. > > Thanks all for review, committed. > > regress tests fails now in my make[2]: Vstupuje se do adresáře „/home/pavel/src/post

Re: Allow default \watch interval in psql to be configured

2025-03-25 Thread Daniel Gustafsson
> On 24 Mar 2025, at 13:42, Ashutosh Bapat wrote: > LGTM. I think this is RFC. Updated CF entry. Thanks all for review, committed. -- Daniel Gustafsson

Re: Allow default \watch interval in psql to be configured

2025-03-24 Thread Ashutosh Bapat
On Mon, Mar 24, 2025 at 5:40 PM Daniel Gustafsson wrote: > > > With this patch, we are doing something unprecedented (at least > > AFAIK); allowing command arguments defaults to be configurable through > > a psql variable (as against an environment variable). I admit that > > configurable through

Re: Allow default \watch interval in psql to be configured

2025-03-24 Thread Ashutosh Bapat
On Fri, Mar 21, 2025 at 2:15 AM Daniel Gustafsson wrote: > > > On 17 Mar 2025, at 13:37, Ashutosh Bapat > > wrote: > > > 0 is an accepted value for interval, even though it might look insensible. > > > > The behaviour should be same in both cases \watch i= and > > \set WATCH_INTERVAL \watch. In

Re: Allow default \watch interval in psql to be configured

2025-03-24 Thread Daniel Gustafsson
> On 21 Mar 2025, at 11:34, Ashutosh Bapat wrote: > There are following differences between command input parsing and > variable value parsing > 1. empty string is considered as 0 value while parsing command input > whereas it wiil cause error when setting to a variable. > #\watch c=1 i= > Fri 21

Re: Allow default \watch interval in psql to be configured

2025-03-17 Thread Ashutosh Bapat
Hi Daniel, On Fri, Mar 14, 2025 at 2:26 PM Daniel Gustafsson wrote: > > On 13 Mar 2025, at 15:03, Greg Sabino Mullane wrote: > > Patch looks good. One minor issue: > > greg=# \set WATCH_INTERVAL -1 > invalid value "-1" for "WATCH_INTERVAL": must be greater than 0.00 > greg=# \set WATCH_INTERVAL

Re: Allow default \watch interval in psql to be configured

2025-03-14 Thread Michael Paquier
On Fri, Mar 14, 2025 at 09:11:15AM -0400, Greg Sabino Mullane wrote: > New patch looks good. TIL I learned you can even use things like > > \set WATCH_INTERVAL 0xAp-4 > > :) You have taste. -- Michael signature.asc Description: PGP signature

Re: Allow default \watch interval in psql to be configured

2025-03-14 Thread Greg Sabino Mullane
New patch looks good. TIL I learned you can even use things like \set WATCH_INTERVAL 0xAp-4 :) Cheers, Greg -- Crunchy Data - https://www.crunchydata.com Enterprise Postgres Software Products & Tech Support

Re: Allow default \watch interval in psql to be configured

2025-03-14 Thread Daniel Gustafsson
On 13 Mar 2025, at 15:03, Greg Sabino Mullane wrote:Patch looks good. One minor issue:greg=# \set WATCH_INTERVAL -1invalid value "-1" for "WATCH_INTERVAL": must be greater than 0.00greg=# \set WATCH_INTERVAL 0.00greg=#We should disallow 0 as the error message impliesAh, nice catch, fixed in the at

Re: Allow default \watch interval in psql to be configured

2025-03-13 Thread Greg Sabino Mullane
Patch looks good. One minor issue: greg=# \set WATCH_INTERVAL -1 invalid value "-1" for "WATCH_INTERVAL": must be greater than 0.00 greg=# \set WATCH_INTERVAL 0.00 greg=# We should disallow 0 as the error message implies I've long wanted to be able to set the default interval for \watch in psql

Re: Allow default \watch interval in psql to be configured

2025-03-13 Thread Laurenz Albe
On Fri, 2025-02-14 at 16:15 +0100, Daniel Gustafsson wrote: > > On 2 Feb 2025, at 19:25, Daniel Gustafsson wrote: > > Attached is rebase with some small levels of polish, unless objected to I > would > like to go ahead with this version. I gave the patch a try, and it works as expected. The cod

Re: Allow default \watch interval in psql to be configured

2025-02-14 Thread Daniel Gustafsson
> On 2 Feb 2025, at 19:25, Daniel Gustafsson wrote: Attached is rebase with some small levels of polish, unless objected to I would like to go ahead with this version. -- Daniel Gustafsson v5-0001-psql-Make-default-watch-interval-configurable.patch Description: Binary data

Re: Allow default \watch interval in psql to be configured

2025-02-02 Thread Daniel Gustafsson
> On 19 Nov 2024, at 11:20, Masahiro Ikeda wrote: > I've tested it and reviewed the patch. I'd like to provide some feedback. Thank you very much for your review and I do apologize for the late response. > I tested with v3 patch and found the following compile error. > It seems that math.h need

Re: Allow default \watch interval in psql to be configured

2024-11-19 Thread Masahiro Ikeda
Hi, Thanks for developing this useful feature! I've tested it and reviewed the patch. I'd like to provide some feedback. (1) I tested with v3 patch and found the following compile error. It seems that math.h needs to be included in variables.c. variables.c: In function 'ParseVariableDouble':

Re: Allow default \watch interval in psql to be configured

2024-11-13 Thread Daniel Gustafsson
> On 4 Nov 2024, at 14:55, Kirill Reshke wrote: > I'm mostly fine with this patch, Thanks for review! > but maybe we need to handle `errno == > ERANGE` inside ParseVariableDouble and provide a better error msg in > this case? > Something like: > ``` > reshke=# \set WATCH_INTERVAL -1e-309 > unde

Re: Allow default \watch interval in psql to be configured

2024-11-04 Thread Kirill Reshke
On Wed, 9 Oct 2024 at 19:24, Daniel Gustafsson wrote: > > > On 9 Oct 2024, at 16:05, Heikki Linnakangas wrote: > > Thanks for looking! > > > I guess the '1000' was supposed to be the maximum, but ParseVariableDouble > > doesn't take a maximum. > > Doh, I had a max parameter during hacking but re

Re: Allow default \watch interval in psql to be configured

2024-10-12 Thread Michael Paquier
On Thu, Oct 10, 2024 at 09:43:27AM +0200, Daniel Gustafsson wrote: > I'm not sure I follow, it's true that the unit is seconds but the patch > doesn't > change the ability to use fractions of a second that we already support today. > > db=# \echo :WATCH_INTERVAL > 2 > db=# \set WATCH_INTERVAL 0.1

Re: Allow default \watch interval in psql to be configured

2024-10-10 Thread Daniel Gustafsson
> On 10 Oct 2024, at 02:01, Michael Paquier wrote: > > On Wed, Oct 09, 2024 at 04:24:27PM +0200, Daniel Gustafsson wrote: >> Fixed. > > -doublesleep = 2; > +doublesleep = pset.watch_interval; > > This forces the use of seconds as unit. The interval values I have

Re: Allow default \watch interval in psql to be configured

2024-10-09 Thread Pavel Stehule
čt 10. 10. 2024 v 2:02 odesílatel Michael Paquier napsal: > On Wed, Oct 09, 2024 at 04:24:27PM +0200, Daniel Gustafsson wrote: > > Fixed. > > -doublesleep = 2; > +doublesleep = pset.watch_interval; > > This forces the use of seconds as unit. The interval values I

Re: Allow default \watch interval in psql to be configured

2024-10-09 Thread Michael Paquier
On Wed, Oct 09, 2024 at 04:24:27PM +0200, Daniel Gustafsson wrote: > Fixed. -doublesleep = 2; +doublesleep = pset.watch_interval; This forces the use of seconds as unit. The interval values I have been using a lot myself are between 0.2s and 0.5s because I usually

Re: Allow default \watch interval in psql to be configured

2024-10-09 Thread Daniel Gustafsson
> On 9 Oct 2024, at 16:05, Heikki Linnakangas wrote: Thanks for looking! > I guess the '1000' was supposed to be the maximum, but ParseVariableDouble > doesn't take a maximum. Doh, I had a max parameter during hacking but removed it since I didn't see a clear usecase for it. Since it's not an

Re: Allow default \watch interval in psql to be configured

2024-10-09 Thread Heikki Linnakangas
On 09/10/2024 16:08, Daniel Gustafsson wrote: Scratching an old itch; I've long wanted to be able to set the default interval for \watch in psql since I almost never want a 2 second wait. The interval can of course be set by passing it to \watch but it's handy during testing and debugging to sav

Allow default \watch interval in psql to be configured

2024-10-09 Thread Daniel Gustafsson
Scratching an old itch; I've long wanted to be able to set the default interval for \watch in psql since I almost never want a 2 second wait. The interval can of course be set by passing it to \watch but it's handy during testing and debugging to save that with just quick \watch. The attached add