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: Improve handling of psql \watch's interval argument
Date: Thu, 16 Mar 2023 00:33:30 +0000
Message-ID: <E1pcbYg-003jli-Fg@gemulon.postgresql.org> (raw)

Improve handling of psql \watch's interval argument

A failure in parsing the interval value defined in the \watch command
was silently switched to 1s of interval between two queries, which can
be confusing.  This commit improves the error handling, and a couple of
tests are added to check after:
- An incorrect value.
- An out-of-range value.
- A negative value.

A value of zero is able to work now, meaning that there is no interval
of time between two queries in a \watch loop.  No backpatch is done, as
it could break existing applications.

Author: Andrey Borodin
Reviewed-by: Kyotaro Horiguchi, Nathan Bossart, Michael Paquier
Discussion: https://postgr.es/m/CAAhFRxiZ2-n_L1ErMm9AZjgmUK=qS6VHb+0SaMn8sqqbhF7How@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/6f9ee74d45aa7c1836b6c12b6e2a958327c16ab5

Modified Files
--------------
src/bin/psql/command.c      | 18 +++++++++++++++---
src/bin/psql/t/001_basic.pl | 17 +++++++++++++++++
2 files changed, 32 insertions(+), 3 deletions(-)



Message-ID: <E1pcbYg-003jli-Fg@gemulon.postgresql.org>
Permalink:  ../E1pcbYg-003jli-Fg@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pcbYg-003jli-Fg@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: Improve handling of psql \watch's interval argument
  In-Reply-To: <E1pcbYg-003jli-Fg@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