From 843d13ec0b94a3385816680a85b7b736803f3154 Mon Sep 17 00:00:00 2001 From: "Andrey M. Borodin" Date: Mon, 20 Feb 2023 10:28:02 -0800 Subject: [PATCH v2] Fix incorrect argument handling in psql \watch Incorrectly parsed argument was silently substituted with 1 second. This is changed to proper error message. Authour: Andrey Borodin Thread: https://postgr.es/m/CAAhFRxiZ2-n_L1ErMm9AZjgmUK%3DqS6VHb%2B0SaMn8sqqbhF7How%40mail.gmail.com --- src/bin/psql/command.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index b5201edf55..15f922e6e6 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -2778,7 +2778,12 @@ exec_command_watch(PsqlScanState scan_state, bool active_branch, { sleep = strtod(opt, NULL); if (sleep <= 0) - sleep = 1; + { + pg_log_error("Invalid watch argument %s", opt); + free(opt); + resetPQExpBuffer(query_buf); + return PSQL_CMD_ERROR; + } free(opt); } -- 2.32.0 (Apple Git-132)