On Thu, 24 Mar 2022 at 21:26, Alvaro Herrera <alvhe...@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.


Reply via email to