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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: Tender Wang <tndrwang(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Consistently use macro HeapTupleIsValid to check the validity of tuples in tablecmds.c
Date: 2025-04-09 14:23:00
Message-ID: 182145.1744208580@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Heikki Linnakangas <hlinnaka(at)iki(dot)fi> writes:
> Inconsistency is not good either though. I'm not sure it's worth the
> churn, but I could get on board a patch to actually replace all
> HeapTupleIsValid(tuple) calls with plain "tuple != NULL" checks. Keep
> HeapTupleIsValid() just for compatibility, with a comment to discourage
> using it.

Would you then advocate for also removing macros such as OidIsValid()
and PointerIsValid()? That gets into a *lot* of code churn, and
subsequent back-patching pain. We had a discussion about that
just recently IIRC, and decided not to go there.

There's also the perennial issue of whether to write
"if (foo != NULL)" or just "if (foo)". I'm not sure it's worth
trying to standardize that completely.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2025-04-09 14:27:42 Build macOS shared modules as dylib rather than bundle
Previous Message Tom Lane 2025-04-09 14:18:38 Re: Possible api miuse bms_next_member