agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Amit Kapila <akapila@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Disallow negative values for max_retention_duration.
Date: Thu, 11 Jun 2026 05:54:20 +0000
Message-ID: <E1wXYMu-001xoY-0C@gemulon.postgresql.org> (raw)

Disallow negative values for max_retention_duration.

The subscription option max_retention_duration accepts an integer value
representing a timeout in milliseconds, where zero means unlimited
retention (no timeout).  Negative values have no useful meaning, but were
silently accepted and stored in the subscription catalog.

A negative value causes should_stop_conflict_info_retention() to always
return true, because TimestampDifferenceExceeds() treats a negative
threshold as already exceeded.  This stops dead tuple retention
immediately rather than honoring the configured timeout.

Fix by rejecting negative values for max_retention_duration during CREATE
SUBSCRIPTION and ALTER SUBSCRIPTION.

Author: Chao Li <lic@highgo.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/9232401A-DEEE-49E1-9D11-D14A776DB82B@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/987440b33a511482232c59a190cc16ae4feff9aa

Modified Files
--------------
src/backend/commands/subscriptioncmds.c    | 5 +++++
src/test/regress/expected/subscription.out | 6 ++++++
src/test/regress/sql/subscription.sql      | 6 ++++++
3 files changed, 17 insertions(+)



Message-ID: <E1wXYMu-001xoY-0C@gemulon.postgresql.org>
Permalink:  ../E1wXYMu-001xoY-0C@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wXYMu-001xoY-0C@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: akapila@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Disallow negative values for max_retention_duration.
  In-Reply-To: <E1wXYMu-001xoY-0C@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox