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

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Convert *GetDatum() and DatumGet*() macros to inline functions
Date: 2022-09-27 19:14:36
Message-ID: E1odG2O-002Hmc-2q@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

The previous macro implementations just cast the argument to a target
type but did not check whether the input type was appropriate. The
function implementation can do better type checking of the input type.

For the *GetDatumFast() macros, converting to an inline function
doesn't work in the !USE_FLOAT8_BYVAL case, but we can use
AssertVariableIsOfTypeMacro() to get a similar level of type checking.

Reviewed-by: Aleksander Alekseev <aleksander(at)timescale(dot)com>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://www.postgresql.org/message-id/flat/8528fb7e-0aa2-6b54-85fb-0c0886dbd6ed%40enterprisedb.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c8b2ef05f481ef06326d7b9f3eb14b303f215c7e

Modified Files
--------------
contrib/intarray/_int_gist.c | 2 +-
doc/src/sgml/xfunc.sgml | 2 +-
src/backend/access/gist/gistutil.c | 2 +-
src/backend/tsearch/ts_parse.c | 4 +-
src/backend/utils/mb/mbutils.c | 12 +-
src/include/access/gin.h | 14 +-
src/include/funcapi.h | 14 +-
src/include/postgres.h | 267 ++++++++++++++++++++++++------------
src/include/tsearch/ts_type.h | 46 +++++--
src/include/tsearch/ts_utils.h | 14 +-
src/include/utils/cash.h | 14 +-
src/include/utils/date.h | 42 +++++-
src/include/utils/expandeddatum.h | 13 +-
src/include/utils/expandedrecord.h | 16 ++-
src/include/utils/geo_decls.h | 98 ++++++++++---
src/include/utils/inet.h | 49 ++++++-
src/include/utils/jsonb.h | 31 +++--
src/include/utils/jsonpath.h | 14 +-
src/include/utils/multirangetypes.h | 23 +++-
src/include/utils/numeric.h | 21 ++-
src/include/utils/pg_lsn.h | 13 +-
src/include/utils/rangetypes.h | 23 +++-
src/include/utils/timestamp.h | 44 ++++--
src/include/utils/uuid.h | 15 +-
src/include/utils/varbit.h | 21 ++-
src/include/utils/xid8.h | 14 +-
src/include/utils/xml.h | 13 +-
27 files changed, 651 insertions(+), 190 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Justin Pryzby 2022-09-27 19:17:10 Re: pgsql: Increase width of RelFileNumbers from 32 bits to 56 bits.
Previous Message Robert Haas 2022-09-27 19:12:56 Re: pgsql: Increase width of RelFileNumbers from 32 bits to 56 bits.