Re: Convert *GetDatum() and DatumGet*() macros to inline functions

From: Aleksander Alekseev <aleksander(at)timescale(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Subject: Re: Convert *GetDatum() and DatumGet*() macros to inline functions
Date: 2022-08-30 13:36:11
Message-ID: CAJ7c6TPGFrzcV4Q-LBWPrpbYLo0ocj9i_O=EJHAP9U5BCwPu6w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Peter,

> To address this, I converted these macros to inline functions

This is a great change!

I encountered passing the wrong arguments to these macros many times,
and this is indeed pretty annoying. I wish we could forbid doing other
stupid things as well, e.g. comparing two Datum's directly, which for
Timestamps works just fine but only on 64-bit platforms. Although this
is certainly out of scope of this thread.

The patch looks good to me, I merely added a link to the discussion. I
added it to the CF application. Cfbot is making its mind at the moment
of writing.

Do you think this should be backported?

--
Best regards,
Aleksander Alekseev

Attachment Content-Type Size
v2-0001-Fix-incorrect-uses-of-Datum-conversion-macros.patch application/octet-stream 15.2 KB
v2-0002-Convert-GetDatum-and-DatumGet-macros-to-inline-fu.patch application/octet-stream 40.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-08-30 13:36:31 Re: Reducing the chunk header sizes on all memory context types
Previous Message Andrew Dunstan 2022-08-30 13:35:51 Re: Strip -mmacosx-version-min options from plperl build