Consistently use macro HeapTupleIsValid to check the validity of tuples in tablecmds.c

From: Tender Wang <tndrwang(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Consistently use macro HeapTupleIsValid to check the validity of tuples in tablecmds.c
Date: 2025-04-09 11:51:10
Message-ID: CAHewXNmz6huegXfMvBE=t-Ngyrh=sS=J2VB+hnhd+sadppdXww@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

While working on another patch, I find that tablecmds.c now has three
ways to check the validity of catalog tuples.
i.
if (tuple != NULL)

ii.
if (!tuple)

iii.
if (HeapTupleIsValid(tuple)

In tablecmds.c, most checks use macro HeapTupleIsValid. For
code readability,
I changed the first and the second formats to the third one, e.g., using
HeapTupleIsValid.

BTW, I searched the other files, some files also have different ways to
check the validity of tuples.
But the attached patch only focuses on tablecmds.c

Any thoughts?

--
Thanks, Tender Wang

Attachment Content-Type Size
0001-Use-macro-HeapTupleIsValid-to-check-tuple-valid-or-n.patch text/plain 6.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2025-04-09 12:07:41 Re: Draft for basic NUMA observability
Previous Message Daniel Gustafsson 2025-04-09 11:48:06 Re: Add missing PGDLLIMPORT markings