Array initialisation notation in syscache.c

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Array initialisation notation in syscache.c
Date: 2022-12-20 22:55:39
Message-ID: CA+hUKGKdpDjKL2jgC-GpoL4DGZU1YPqnOFHbDqFkfRQcPaR5DQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

While hacking on a new system catalogue for a nearby thread, it
occurred to me that syscache.c's table of entries could be made more
readable and less error prone. They look like this:

{AttributeRelationId, /* ATTNUM */
AttributeRelidNumIndexId,
2,
{
Anum_pg_attribute_attrelid,
Anum_pg_attribute_attnum,
0,
0
},
128
},

Do you think this is better?

[ATTNUM] = {
AttributeRelationId,
AttributeRelidNumIndexId,
{
Anum_pg_attribute_attrelid,
Anum_pg_attribute_attnum
},
128
},

We could also consider writing eg ".nbuckets = 128", but it's not a
complicated struct that the eye gets lost in, so I didn't bother with
that in the attached.

Attachment Content-Type Size
0001-Improve-notation-of-cacheinfo-table-in-syscache.c.patch text/x-patch 22.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2022-12-20 23:00:02 Re: meson files copyright
Previous Message Peter Smith 2022-12-20 22:29:58 Re: pgsql: Doc: Explain about Column List feature.