Re: Array initialisation notation in syscache.c

Поиск
Список
Период
Сортировка
От Thomas Munro
Тема Re: Array initialisation notation in syscache.c
Дата
Msg-id CA+hUKGKoPH31RBTAqq9MaTSocc2C28b9yFd9CJeYNrekc+oKgw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Array initialisation notation in syscache.c  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Array initialisation notation in syscache.c  (Thomas Munro <thomas.munro@gmail.com>)
Список pgsql-hackers
On Wed, Dec 21, 2022 at 12:05 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Thomas Munro <thomas.munro@gmail.com> 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 you think about this version?

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

> I'm kind of neutral on using "[N] = " as a substitute for
> ordering the entries correctly.  While that does remove
> one failure mode, it seems like it adds another (ie
> failure to provide an entry at all would be masked).

It fails very early in testing if you do that.  Admittedly, the
assertion is hard to understand, but if I add a new assertion close to
the cause with a new comment to say what you did wrong, I think that
should be good enough?

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Ranier Vilela
Дата:
Сообщение: Avoid lost result of recursion (src/backend/optimizer/util/inherit.c)
Следующее
От: Justin Pryzby
Дата:
Сообщение: Re: Small miscellaneus fixes (Part II)