From: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
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:43:24 |
Message-ID: | bccf2803-5252-47c2-9ff0-340502d5bd1c@iki.fi |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 09/04/2025 17:23, Tom Lane wrote:
> 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.
PointerIsValid is pretty pointless, I think I'd be in favor of
eliminating that.
OidIsValid() is a little more sensible. If you write "oid !=
InvalidOid", that reads as a double negative, "is oid not invalid".
But yeah, probably not worth the churn.
> 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.
Agreed. I use both, depending on which mood I'm in.
--
Heikki Linnakangas
Neon (https://neon.tech)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2025-04-09 15:11:14 | Re: Build macOS shared modules as dylib rather than bundle |
Previous Message | Chapman Flack | 2025-04-09 14:43:22 | Re: Cleaning up ERRCODE usage in our XML code |