Re: tid_blockno() and tid_offset() accessor functions - Mailing list pgsql-hackers

From Andres Freund
Subject Re: tid_blockno() and tid_offset() accessor functions
Date
Msg-id zlf5j4xjiycgse4ufgoljw7klgiroauufaxcrl4gcmh2yxdiha@7eavicmyk2dd
Whole thread
In response to Re: tid_blockno() and tid_offset() accessor functions  (Greg Sabino Mullane <htamfids@gmail.com>)
Responses Re: tid_blockno() and tid_offset() accessor functions
List pgsql-hackers
Hi,

On 2026-03-09 09:34:46 -0400, Greg Sabino Mullane wrote:
> On Sun, Mar 8, 2026 at 3:31 PM Tomas Vondra <tomas@vondra.me> wrote:
> 
> > No opinion. For displaying the bogus TID value (like "(-1,0)") it's
> > probably OK to show values that are a bit weird. If anything, we should
> > be more careful on input, it's too late for tid_block() to decide what to
> > do with an "impossible" TID value.
> >
> 
> This one doesn't sit right with me. I think it's not too late. No reason
> why tid_block cannot be stricter here than tid itself and complain. Other
> than that, the patch looks good to me.

I don't see any advantage in that. These functions are useful for inspecting
tid values that come from some source. When would you *ever* gain *anything*
from not being able to see the block / offset of a tid datum that you already
have?

This isn't an end user focused type / set of accessor functions were being
particularly careful about input validation will perhaps prevent users from
making mistakes...

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Greg Sabino Mullane
Date:
Subject: Re: [PATCH] libpq: try all addresses for a host before moving to next on target_session_attrs mismatch
Next
From: Ranier Vilela
Date:
Subject: Re: Avoid multiple calls to memcpy (src/backend/access/index/genam.c)