PartitionKeyData->partattrs, refactor some 0 to InvalidAttrNumber

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: PartitionKeyData->partattrs, refactor some 0 to InvalidAttrNumber
Date: 2025-11-14 15:47:35
Message-ID: CACJufxGmsphWX150CxMU6KSed-x2fmTH3UpCwHpedGmjV1Biug@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

hi.

if PartitionKeyData->partattrs is 0, then it means that partition key is
expression, else it's column reference.

we can change from
if (key->partattrs[i] == 0)
to
if (key->partattrs[i] == InvalidAttrNumber)

the reason I can think of is to improve grepability.
numeric value 0 is too common to reliably locate relevant code.

what do you think?

--
jian
https://www.enterprisedb.com/

Attachment Content-Type Size
v1-0001-partattrs-0-refactor-to-InvalidAttrNumber.patch text/x-patch 5.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2025-11-14 16:00:08 Re: Performance issues with parallelism and LIMIT
Previous Message Maxim Orlov 2025-11-14 15:40:50 Re: POC: make mxidoff 64 bits