Re: [PATCH v1] remove redundant check of item pointer

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Junwang Zhao <zhjwpku(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH v1] remove redundant check of item pointer
Date: 2022-07-15 02:13:01
Message-ID: CAApHDvr1xVuxNsGzrYT=gja0X-50EadiYH+mSFoJw1t0V70FMQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 15 Jul 2022 at 10:31, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> for non-Assert builds, ItemPointerGetOffsetNumberNoCheck() and
> ItemPointerGetOffsetNumber() are the same, so I don't see the point to
> making this change. Frankly, I don't know why we even have two
> functions for this. I am guessing ItemPointerGetOffsetNumberNoCheck is
> for cases where you have an Assert build and do not want the check.

We'll want to use ItemPointerGetOffsetNumberNoCheck() where the TID
comes from sources we can't verify. e.g user input... '(2,0)'::tid.
We want to use ItemPointerGetOffsetNumber() for item pointers that
come from locations that we want to ensure are correct. e.g TIDs
we're storing in an index.

David

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2022-07-15 02:14:33 Re: BUG #17434: CREATE/DROP DATABASE can be executed in the same transaction with other commands
Previous Message David G. Johnston 2022-07-15 01:27:17 Re: doc: Clarify Routines and Extension Membership