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

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Julien Rouhaud <rjuju123(at)gmail(dot)com>, Aleksander Alekseev <aleksander(at)timescale(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Convert *GetDatum() and DatumGet*() macros to inline functions
Date: 2022-09-27 19:26:20
Message-ID: 4085b763-3e75-d6a9-d8ca-e256675dfdca@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 26.09.22 19:34, Tom Lane wrote:
> I think we can do this while still having reasonable type-safety
> by adding AssertVariableIsOfTypeMacro() checks to the macros.
> An advantage of that solution is that we verify that the code
> will be safe for a 32-bit build even in 64-bit builds. (Of
> course, it's just checking the variable's type not its lifespan,
> but this is still a step forward.)
>
> 0001 attached is what you committed, 0002 is a proposed delta
> to fix the Fast macros.

Thanks, I committed it like that.

(I had looked into AssertVariableIsOfTypeMacro() for an earlier variant
of this patch, before I had the idea with the inline functions. It's in
general a bit too strict, such as with short vs int, and signed vs
unsigned, but it should work ok for this limited set of uses.)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Champion 2022-09-27 19:44:38 Re: [PATCH] Log details for client certificate failures
Previous Message Justin Pryzby 2022-09-27 19:17:10 Re: pgsql: Increase width of RelFileNumbers from 32 bits to 56 bits.