pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: psql: Fix \watch when using interval values less than 1ms
Date: Mon, 14 Oct 2024 03:28:25 +0000
Message-ID: <E1t0Bkv-000jWL-GR@gemulon.postgresql.org> (raw)

psql: Fix \watch when using interval values less than 1ms

Attempting to use an interval of time less than 1ms would cause \watch
to hang.  This was confusing, so let's change the logic so as an
interval lower than 1ms behaves the same as 0.

Comments are added to mention that the internals of do_watch() had
better rely on "sleep_ms", the interval value in milliseconds.  While on
it, this commit adds a test to check the behavior of interval values
less than 1ms.

\watch hanging for interval values less than 1ms existed before
6f9ee74d45aa, that has changed the code to support an interval value of
0.

Reported-by: Heikki Linnakangas
Author: Andrey M. Borodin, Michael Paquier
Discussion: https://postgr.es/m/88445e0e-3156-4b9d-afae-9a1a7b1631f6@iki.fi
Backpatch-through: 16

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8a6170860c83d3f44b7d97193a2c23539c24f76d

Modified Files
--------------
src/bin/psql/command.c      | 11 ++++++++---
src/bin/psql/t/001_basic.pl | 10 ++++++++--
2 files changed, 16 insertions(+), 5 deletions(-)



view thread (3+ messages)  latest in thread

Message-ID: <E1t0Bkv-000jWL-GR@gemulon.postgresql.org>
Permalink:  ../E1t0Bkv-000jWL-GR@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1t0Bkv-000jWL-GR@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: psql: Fix \watch when using interval values less than 1ms
  In-Reply-To: <E1t0Bkv-000jWL-GR@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox