Re: Reject negative max_retention_duration values

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
Cc: 'Chao Li' <li(dot)evan(dot)chao(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>
Subject: Re: Reject negative max_retention_duration values
Date: 2026-06-10 05:40:41
Message-ID: aij42d-KJF09YGyV@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 10, 2026 at 05:12:26AM +0000, Hayato Kuroda (Fujitsu) wrote:
> Dear Chao,
>
> > Yes, this patch rejects negative values at CREATE/ALTER SUBSCRIPTION time,
> > so in theory the if (MySubscription->maxretention <= 0) change is not strictly
> > necessary. I made that change for a few reasons (from strong do weak):
>
> I personal preference is to use Assert() for detecting cannot-happen case,
> but it's not very strong opinion. Let's see how others say.

An assertion offers less protection than an elog(ERROR) if a value is
read from catalogs, which could be the case here? Think for example
corrupted catalog data. (I did not read the patch in details, so I
may have missed something, of course, but I was under the impression
that this could apply for this case with MySubscription.)
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2026-06-10 05:50:14 Re: RFC: Boyer-Moore-Horspool optimization for LIKE '%pattern%' searches
Previous Message Michael Paquier 2026-06-10 05:37:57 Re: [(known) BUG] DELETE/UPDATE more than one row in partitioned foreign table