Array initialisation notation in syscache.c - Mailing list pgsql-hackers

From Thomas Munro
Subject Array initialisation notation in syscache.c
Date
Msg-id CA+hUKGKdpDjKL2jgC-GpoL4DGZU1YPqnOFHbDqFkfRQcPaR5DQ@mail.gmail.com
Whole thread Raw
Responses Re: Array initialisation notation in syscache.c  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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

pgsql-hackers by date:

Previous
From: Peter Smith
Date:
Subject: Re: pgsql: Doc: Explain about Column List feature.
Next
From: Thomas Munro
Date:
Subject: Re: meson files copyright