Re: Array initialisation notation in syscache.c

2023-11-14 Thread Alvaro Herrera
On 2023-Nov-14, Thomas Munro wrote: > I suppose we could also supply a set of macros with the numbers that > map straight onto the numberless ones, with a note that they will be > deleted after N releases. Maybe just keep compatibility ones with 1 and 2 arguments (the ones most used) forever, or

Re: Array initialisation notation in syscache.c

2023-11-13 Thread Thomas Munro
On Thu, Sep 21, 2023 at 8:19 PM Peter Eisentraut wrote: > On 31.03.23 04:16, Thomas Munro wrote: > > From the light relief department, here is some more variadic macrology: > > > > - tp = SearchSysCache1(TSPARSEROID, ObjectIdGetDatum(prsId)); > > + tp = SearchSysCache(TSPARSEROID,

Re: Array initialisation notation in syscache.c

2023-09-21 Thread Peter Eisentraut
On 31.03.23 04:16, Thomas Munro wrote: From the light relief department, here is some more variadic macrology: - tp = SearchSysCache1(TSPARSEROID, ObjectIdGetDatum(prsId)); + tp = SearchSysCache(TSPARSEROID, ObjectIdGetDatum(prsId)); I'm worried that if we are removing the

Re: Array initialisation notation in syscache.c

2022-12-22 Thread Thomas Munro
On Thu, Dec 22, 2022 at 5:36 AM Peter Eisentraut wrote: > This looks like a good improvement to me. Thanks both. Pushed. > (I have also thought about having this generated from the catalog > definition files somehow, but one step at a time ...) Good plan.

Re: Array initialisation notation in syscache.c

2022-12-21 Thread Tom Lane
Nikita Malakhov writes: > Wanted to ask this since I encountered a need for a cache with 5 keys - > why is the syscache index still limited to 4 keys? Because there are no cases requiring 5, so far. (A unique index with as many as 5 keys seems a bit fishy btw.) regards,

Re: Array initialisation notation in syscache.c

2022-12-21 Thread Nikita Malakhov
Hi! Wanted to ask this since I encountered a need for a cache with 5 keys - why is the syscache index still limited to 4 keys? Thanks! On Wed, Dec 21, 2022 at 7:36 PM Peter Eisentraut < peter.eisentr...@enterprisedb.com> wrote: > On 21.12.22 04:16, Thomas Munro wrote: > > On Wed, Dec 21, 2022

Re: Array initialisation notation in syscache.c

2022-12-21 Thread Peter Eisentraut
On 21.12.22 04:16, Thomas Munro wrote: On Wed, Dec 21, 2022 at 1:33 PM Thomas Munro wrote: KEY(Anum_pg_attribute_attrelid, Anum_pg_attribute_attnum), I independently rediscovered that our VA_ARGS_NARGS() macro in c.h always returns 1 on MSVC via trial-by-CI. Derp.

Re: Array initialisation notation in syscache.c

2022-12-20 Thread Thomas Munro
On Wed, Dec 21, 2022 at 1:33 PM Thomas Munro wrote: > KEY(Anum_pg_attribute_attrelid, > Anum_pg_attribute_attnum), I independently rediscovered that our VA_ARGS_NARGS() macro in c.h always returns 1 on MSVC via trial-by-CI. Derp. Here is the same patch, no change from v2,

Re: Array initialisation notation in syscache.c

2022-12-20 Thread Thomas Munro
On Wed, Dec 21, 2022 at 12:05 PM Tom Lane wrote: > Thomas Munro writes: > > Do you think this is better? > > I'm not at all on board with adding runtime overhead to > save maintaining the nkeys fields. I don't see how to do it at compile time without getting the preprocessor involved. What do

Re: Array initialisation notation in syscache.c

2022-12-20 Thread Tom Lane
Thomas Munro writes: > Do you think this is better? I'm not at all on board with adding runtime overhead to save maintaining the nkeys fields. Getting rid of the useless trailing zeroes in the key[] arrays is clearly a win, though. I'm kind of neutral on using "[N] = " as a substitute for

Array initialisation notation in syscache.c

2022-12-20 Thread Thomas Munro
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,