Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w0Jx4-001oCt-0G for pgsql-hackers@arkaria.postgresql.org; Wed, 11 Mar 2026 13:50:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w0Jx2-009I3I-1M for pgsql-hackers@arkaria.postgresql.org; Wed, 11 Mar 2026 13:50:16 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w0Jx2-009I39-02 for pgsql-hackers@lists.postgresql.org; Wed, 11 Mar 2026 13:50:16 +0000 Received: from mail-yw1-x1134.google.com ([2607:f8b0:4864:20::1134]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w0Jx0-00000001cG4-1RM0 for pgsql-hackers@postgresql.org; Wed, 11 Mar 2026 13:50:15 +0000 Received: by mail-yw1-x1134.google.com with SMTP id 00721157ae682-798578e2918so130117027b3.2 for ; Wed, 11 Mar 2026 06:50:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773237013; cv=none; d=google.com; s=arc-20240605; b=WN602GjhxLE90Q2fZusAbQxnT8Q+n+3EhAumM2I2iu5UscFSLtP5fCkyGGDMG0Wqwz L6qAfwZZ8I3p6kEskTfICSYAktEVcCtDU3IEQoWNxVqDAbXKkCOSA1FdnS5OkDstKSFq gjvgEFGlAulcfLa4Agzo8Yj0bwqysZV6RGnDhH/KBgXDyFwF0uJvEFuPCNiltvay6r1z Akpph1KMYhutgFc/TkvplUSHrMnwZ7ISt+myHxPt2tevDp6/1k9uohnDqeVQpEgDZUSF rabRIvs/PhUWbZ8oqdIxhSXklxlGuclyb3u4r61e3BZfF09cOu2d+1KD7G98ZPZ6aWHw 0dNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=c1WSh4lLomuVMSan78K5jFmBcOyGGoyWPzV7DK2MKEc=; fh=slWYKmgmkIrr61oot8nj2xrf8jVksunFA7Fd05/lYCY=; b=jrrfPFn5eYbwR0OVB9SJ9TSQ1NP1x9dxKmQWAAZ1C/tfjAlru7Y68rFEkNQWTdH1qU ZyAjygTWoukag+0KftDY8Io0W4fXy5AeH7voVGxL9JlTrOaitRXndQ4frPCjV7lqCgSh GPnsW2boC2c7xQDgZJu3y7eK00wj42aAXgfczk+xm09YP/upPnnC+aNFc/8GHFEZX2P6 9JP5xinTPIjGXfjQy1wbleVca9iTjV9w+A0RP+i2TTBDL/d8gDFmJhHK+wCed4tTtqQP ejtznbmIVhiovuBiRxoSW3NxW4HOq6iYa70lmvrUSmiqoUPNi0deT6U3LjQYYs+pkI4+ dZFQ==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773237013; x=1773841813; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=c1WSh4lLomuVMSan78K5jFmBcOyGGoyWPzV7DK2MKEc=; b=GId56oz4/qXueRrjXL2POd2bkvFPb+w8KyaWdthGpeztikgbZm9gr6/bXRTzuEzyV+ l9CpfStDRGpeXPRO1JYKM/5HD3FygFAGtSZbwWHjgPg4L4M534Pcs3z+0m5T2yBVkHP0 yRl9ybb/0Q68YX+OQcTOMGwCLAHZBKFLS5BklYhh+/M8xgUP5kxZ7vtidl+uqqOp9fZe EiydWqIySwRUInzjFWyjY6v4Gzk2It50VcMhbVhpDzBIU0sA91Y48WdpxW8cwWFQbOlZ A9ulfYDzKR/8NiT0mLU1icdpeTMui7t96X2qinD/gETSgnBxkfhNs8llrwemiPXsyYJD vaIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773237013; x=1773841813; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=c1WSh4lLomuVMSan78K5jFmBcOyGGoyWPzV7DK2MKEc=; b=QePDuE2eORfjG9ruHGGIiTFzjkvw3ogVlXS+TXvniIrLOeWio5o0mbeukzYRII/qfF zBQohR7Yp5aP3MXsR2jzspoTIK28csf1zNNEK4B8muNcZqkVid5+TROrN1ww15NVrRt6 RElcCbji1HTOF1K7L63JHZIY/C5wfJsIPcYnf2IVJrfMSFu59l7BFq04CIzf4xucjXy1 Q7ScZZF4o35fQey7rQvU43xjjVQhDFh9f7wHbn9F5TQE8cIuJXuhZF4QYGJkML+dvFqs uvAzxVNpQww4kBgUwIZp7jwi0H7dEaFydwHKesuKfXc0OwM1wxfc0VaPmP1qX/FK/JG7 kLhQ== X-Forwarded-Encrypted: i=1; AJvYcCUYGfPoRGH5/Dyf0ksPa6RqczVa0HnYzqMlCEzFhulsRx4DkukseH3lelrUJ+XE0pmA9YkcNi9FUSUyY4K4@postgresql.org X-Gm-Message-State: AOJu0Yy4cQALMFrQt2xpUA9FbWWosTT9gU5sGaL4ll9kfyrC9DNxdoug 9mlg4MCx+2I69umq9T7DtzTMXZB0LVog5msg2bgdg89dFDtDqLOcNwKsfXY1Qw7HUCmY9/E3dR6 9uN7vvDIkArc/cQJUb28oL76lknYi8n0= X-Gm-Gg: ATEYQzwSJtKJWpd+1U/HBpI7mWeBs3gizwoGZa1ZIvt7ORyHXYssv84PEfWUjxXIuFY XILlxz5ZPTz57r6eEwM0uNbg0k0tfM8eTZWEyh1Ig2AoptuN7uVtucEPmHJOUy3PFiPbzeGDJVu +nMYJt695cBE2LSn2X5egQdmEvs7JDv+86Xmy76OEumfRvOzRcXMhTy5tx6gIS2+i8cvkba8pJX UYlZcaWZ8Ykl7vbBmMA6pCKbEzNJJg/9x67MtpJhWaOjgbLrmfQGBE0VyjNxYl+tyTTJmnm3WzD 3Gn7JQ== X-Received: by 2002:a05:690c:6c8a:b0:798:77bd:109e with SMTP id 00721157ae682-7991800f3e0mr21091217b3.63.1773237013485; Wed, 11 Mar 2026 06:50:13 -0700 (PDT) MIME-Version: 1.0 References: <57388743-e380-4145-8b77-86ed23b062de@vondra.me> In-Reply-To: From: Ayush Tiwari Date: Wed, 11 Mar 2026 19:20:01 +0530 X-Gm-Features: AaiRm52NaDEjz3vcLupFDI2kfrHzG79ybfELZK0MDgsmlliL67CHs25VodKZ9MQ Message-ID: Subject: Re: tid_blockno() and tid_offset() accessor functions To: Andres Freund Cc: Greg Sabino Mullane , Tomas Vondra , Alexandre Felipe , pgsql-hackers@postgresql.org Content-Type: multipart/alternative; boundary="0000000000004a9e2f064cbfea45" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000004a9e2f064cbfea45 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, Thank you all for the reviews and discussion! On the strictness question raised by Greg =E2=80=94 I agree with Andres her= e. These functions are meant for inspecting tid values that already exist, so rejecting "impossible" values like (-1,0) would not be providing any real benefit. I believe the tid input function is the appropriate place for any validation, and these assessors should just faithfully report what's in the datum. Regards, Ayush On Mon, 9 Mar 2026 at 19:32, Andres Freund wrote: > Hi, > > On 2026-03-09 09:34:46 -0400, Greg Sabino Mullane wrote: > > On Sun, Mar 8, 2026 at 3:31=E2=80=AFPM Tomas Vondra w= rote: > > > > > 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 shou= ld > > > be more careful on input, it's too late for tid_block() to decide wha= t > to > > > do with an "impossible" TID value. > > > > > > > This one doesn't sit right with me. I think it's not too late. No reaso= n > > why tid_block cannot be stricter here than tid itself and complain. Oth= er > > 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 bein= g > particularly careful about input validation will perhaps prevent users fr= om > making mistakes... > > Greetings, > > Andres Freund > --0000000000004a9e2f064cbfea45 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

Thank you all for the reviews and discussion!
On the strictness question raised by Greg =E2=80=94 I agree with Andr= es here. These functions are meant for inspecting tid values that already e= xist, so rejecting "impossible" values like (-1,0) would not be p= roviding any real benefit. I believe the tid input function is the appropri= ate place for any validation, and these assessors should just faithfully re= port what's in the datum.

Regards,
Ayush

On Mon, 9 Mar 2026 at 19:32, Andres Freund <andres@anarazel.de> wrote:
Hi,

On 2026-03-09 09:34:46 -0400, Greg Sabino Mullane wrote:
> On Sun, Mar 8, 2026 at 3:31=E2=80=AFPM 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 de= cide 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. Ot= her
> than that, the patch looks good to me.

I don't see any advantage in that. These functions are useful for inspe= cting
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 alrea= dy
have?

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

Greetings,

Andres Freund
--0000000000004a9e2f064cbfea45--