Re: "could not find pathkey item to sort" for TPC-DS queries 94-96

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: "could not find pathkey item to sort" for TPC-DS queries 94-96
Дата
Msg-id 525397.1618929765@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: "could not find pathkey item to sort" for TPC-DS queries 94-96  (ilmari@ilmari.org (Dagfinn Ilmari Mannsåker))
Список pgsql-hackers
ilmari@ilmari.org (Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?=) writes:
> ilmari@ilmari.org (Dagfinn Ilmari Mannsåker) writes:
>> There are 10 instances of this exact loop scattered around the codebase.
>> Is it worth it turning it into a static inline function?

> Something like the attached, maybe?

Meh.  The trouble with this is that the call sites don't all declare
the pointer variable the same way.  While the written-out loops can
look the same regardless, a function can only accommodate one choice
without messy casts.  For my money, the notational savings here is
small enough that the casts really discourage doing anything.

So if we wanted to do this, I'd think about using a macro:

#define strip_relabeltype(nodeptr) \
    while (nodeptr && IsA(nodeptr, RelabelType))
        nodeptr = ((RelabelType *) nodeptr)->arg

...

    strip_relabeltype(em_expr);

...

Since the argument would have to be a variable, the usual
multiple-reference hazards of using a macro don't seem to apply.

(Probably the macro could do with "do ... while" decoration
to discourage any syntactic oddities, but you get the idea.)

            regards, tom lane



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

Предыдущее
От: Masahiko Sawada
Дата:
Сообщение: Re: Replication slot stats misgivings
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [bug?] Missed parallel safety checks, and wrong parallel safety