Re: Remove useless int64 range checks on BIGINT sequence MINVALUE/MAXVALUE values

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Greg Nancarrow <gregn4422(at)gmail(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Remove useless int64 range checks on BIGINT sequence MINVALUE/MAXVALUE values
Date: 2021-07-03 10:44:15
Message-ID: 2690d581-6ab9-de84-968c-d6e5374e245d@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 21.06.21 13:32, Greg Nancarrow wrote:
> On Mon, Jun 21, 2021 at 8:32 PM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
>>
>> It might be worth putting in a comment to mention that the check is
>> not needed. Just in case someone looks again one day and thinks the
>> checks are missing.
>>
>> Probably best to put this in the July commitfest so it does not get missed.
>
> Updated the patch, and will add it to the Commitfest, thanks.

I don't think this is a good change. It replaces one perfectly solid,
harmless, and readable line of code with six lines of comment explaining
why the code isn't necessary (times two). And the code is now less
robust against changes elsewhere. To maintain this robustness, you'd
have to add assertions that prove that what the comment is saying is
actually true, thus adding even more code.

I think we should leave it as is.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2021-07-03 11:38:53 Re: [PATCH v3 1/1] Fix detection of preadv/pwritev support for OSX.
Previous Message Peter Eisentraut 2021-07-03 10:34:10 Re: Add ZSON extension to /contrib/