public inbox for [email protected]  
help / color / mirror / Atom feed
From: Kirill Reshke <[email protected]>
To: pgsql-hackers <[email protected]>
Subject: Define DatumGetInt8 function.
Date: Mon, 29 Dec 2025 16:02:34 +0500
Message-ID: <CALdSSPhFyb9qLSHee73XtZm1CBWJNo9+JzFNf-zUEWCRW5yEiQ@mail.gmail.com> (raw)

Hi hackers!

I am currently involved in the Cloudberry kernel rebase process[0]. We
are rebasing [0] which is based on pg-14 on pg-16 kernel. During this
process I noticed rebase conflicts introduced  by c8b2ef0. This commit
defines a number of include functions for datum conversion.

During this rebase resolution, I noticed that there is an Int8GetDatum
function, but there is no DatumGetInt8, which I want to use. All other
inline functions seem to be provided in pairs by postgres.h. So it
looks convenient to define DatumGetInt8 in postgres.h?

FPA doing just that.


[0] https://github.com/apache/cloudberry

-- 
Best regards,
Kirill Reshke


Attachments:

  [application/octet-stream] v1-0001-Define-DatumGetInt8-function.patch (728B, 2-v1-0001-Define-DatumGetInt8-function.patch)
  download | inline diff:
From d5dac86267e48e24f7d082cb2c265f8d97e17c23 Mon Sep 17 00:00:00 2001
From: reshke <[email protected]>
Date: Mon, 29 Dec 2025 10:53:52 +0000
Subject: [PATCH v1] Define DatumGetInt8 function.

---
 src/include/postgres.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/include/postgres.h b/src/include/postgres.h
index 357cbd6fd96..680d3e30907 100644
--- a/src/include/postgres.h
+++ b/src/include/postgres.h
@@ -134,6 +134,16 @@ CharGetDatum(char X)
 	return (Datum) X;
 }
 
+/*
+ * DatumGetInt8
+ *		Returns 8-bit integer value of a datum.
+ */
+static inline int8
+DatumGetInt8(Datum X)
+{
+	return (int8) X;
+}
+
 /*
  * Int8GetDatum
  *		Returns datum representation for an 8-bit integer.
-- 
2.43.0



view thread (9+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: Define DatumGetInt8 function.
  In-Reply-To: <CALdSSPhFyb9qLSHee73XtZm1CBWJNo9+JzFNf-zUEWCRW5yEiQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox