aboutsummaryrefslogtreecommitdiffstats
path: root/main/pllua/fix-on-32bit.patch
blob: fda3f78052c5617249f29566cb704c804e3c0da9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From 904a53bcc696a683f4a114d05400e5315e0ae70d Mon Sep 17 00:00:00 2001
From: eugwne <eugeney.sergeev@gmail.com>
Date: Mon, 10 Jul 2017 19:51:01 +0300
Subject: [PATCH] 64 lua -> pg 32bit system

Patch-Source: https://github.com/pllua/pllua/commit/904a53bcc696a683f4a114d05400e5315e0ae70d
---
 plluaapi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/plluaapi.c b/plluaapi.c
index f47a3b9..d0a1b4d 100644
--- a/plluaapi.c
+++ b/plluaapi.c
@@ -1095,8 +1095,18 @@ Datum luaP_todatum (lua_State *L, Oid type, int typmod, bool *isnull, int idx) {
         dat = Int32GetDatum(lua_tointeger(L, idx));
         break;
       case INT8OID:
+#ifdef USE_FLOAT8_BYVAL
         dat = Int64GetDatum(get64lua(L, idx));
         break;
+#else
+      {
+        int64* value = (int64*)SPI_palloc(sizeof(int64));
+        *value = get64lua(L, idx);
+        dat = PointerGetDatum(value);
+        break;
+      }
+#endif
+
       case TEXTOID: {
         const char *s = lua_tostring(L, idx);
         if (s == NULL) elog(ERROR,