Re: turn fastgetattr and heap_getattr to inline functions
От | Japin Li |
---|---|
Тема | Re: turn fastgetattr and heap_getattr to inline functions |
Дата | |
Msg-id | MEYP282MB166986146989BA9DC1F311B0B6199@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM обсуждение исходный текст |
Ответ на | Re: turn fastgetattr and heap_getattr to inline functions (Alvaro Herrera <alvherre@alvh.no-ip.org>) |
Ответы |
Re: turn fastgetattr and heap_getattr to inline functions
|
Список | pgsql-hackers |
On Thu, 24 Mar 2022 at 21:26, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote: > On 2022-Mar-24, Michael Paquier wrote: > >> Hmm. I think that you'd better add a return at the end of each >> function? Some compilers are dumb in detecting that all the code >> paths return (aka recent d0083c1) and could generate warnings, even if >> things are coded to return all the time, like in your patch. > > Hmm, OK to do something about that. I added pg_unreachable(): looking > at LWLockAttemptLock(), it looks that that should be sufficient. Hi, I want to know why we do not use the following style? +static inline Datum +heap_getattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull) +{ + if (attnum > 0) + { + if (attnum > (int) HeapTupleHeaderGetNatts(tup->t_data)) + return getmissingattr(tupleDesc, attnum, isnull); + else + return fastgetattr(tup, attnum, tupleDesc, isnull); + } + + return heap_getsysattr(tup, attnum, tupleDesc, isnull); +} -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.
В списке pgsql-hackers по дате отправления: