Disallow negative values for max_retention_duration.
Amit Kapila <akapila@postgresql.org>
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
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/commands/subscriptioncmds.c | modified | +5 −0 |
| src/test/regress/expected/subscription.out | modified | +6 −0 |
| src/test/regress/sql/subscription.sql | modified | +6 −0 |
Discussion
- Reject negative max_retention_duration values 9 messages · 2026-06-09 → 2026-06-10