Re: [PATCH] Missing Assert in the code

From: Dmitry Nikitin <pgsql-hackers(at)dima(dot)nikitin(dot)name>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] Missing Assert in the code
Date: 2024-11-26 09:24:37
Message-ID: 172136986.20241126122437@dima.nikitin.name
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello Alvaro,

Monday, November 25, 2024, 10:51:31 PM, you wrote:

AH> Hmm, I think if we believe this to be really possible, we should have an
AH> 'if/elog' test (or maybe a full ereport with ERRCODE_DATA_CORRUPTED
AH> errcode) rather than an assertion. I think the assertion adds nothing
AH> of value here, but maybe an 'if' test would.
I don't mind of 'if' however it's not clear for me what to follow on other (error) branch of that 'if'.

AH> Did you examine the other callers of PageGetMaxOffsetNumber()? It's a
AH> large bunch.
Mostly it used in loops. So some code will be gracefully skipped and that's it.
However the case discussed is different because -1 index of an array will be accessed. Which is much
worse than a bare assertion at least.

--
Best regards,
Dmitry mailto:pgsql-hackers(at)dima(dot)nikitin(dot)name

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2024-11-26 09:25:13 Re: Doc: typo in config.sgml
Previous Message Peter Eisentraut 2024-11-26 09:12:06 Re: SQL:2023 JSON simplified accessor support