fix gotchas with pg 16&17 master
authorTeodor Sigaev <teodor@sigaev.ru>
Sat, 28 Dec 2024 08:11:40 +0000 (11:11 +0300)
committerTeodor Sigaev <teodor@sigaev.ru>
Sat, 28 Dec 2024 08:11:40 +0000 (11:11 +0300)
smlar.c
smlar_gin.c
smlar_gist.c

diff --git a/smlar.c b/smlar.c
index 672e453..ca0651f 100644 (file)
--- a/smlar.c
+++ b/smlar.c
@@ -526,6 +526,7 @@ Array2SimpleArrayU(ProcTypeInfo info, ArrayType *a, void *cache)
                                                {
                                                        case TF_LOG:
                                                                s->df[i] = (1.0 + log( s->df[i] ));
                                                {
                                                        case TF_LOG:
                                                                s->df[i] = (1.0 + log( s->df[i] ));
+                                                               /* FALLTHROUGH */
                                                        case TF_N:
                                                                s->df[i] *= stat->idf;
                                                                break;
                                                        case TF_N:
                                                                s->df[i] *= stat->idf;
                                                                break;
index 798b9be..4164fa4 100644 (file)
@@ -5,7 +5,11 @@
 #include "fmgr.h"
 #include "access/gin.h"
 #include "access/skey.h"
 #include "fmgr.h"
 #include "access/gin.h"
 #include "access/skey.h"
+#if PG_VERSION_NUM < 130000
+#include "access/tuptoaster.h"
+#else
 #include "access/heaptoast.h"
 #include "access/heaptoast.h"
+#endif
 
 PG_FUNCTION_INFO_V1(smlararrayextract);
 Datum smlararrayextract(PG_FUNCTION_ARGS);
 
 PG_FUNCTION_INFO_V1(smlararrayextract);
 Datum smlararrayextract(PG_FUNCTION_ARGS);
index 8cd044b..a142a77 100644 (file)
@@ -3,7 +3,11 @@
 #include "fmgr.h"
 #include "access/gist.h"
 #include "access/skey.h"
 #include "fmgr.h"
 #include "access/gist.h"
 #include "access/skey.h"
+#if PG_VERSION_NUM < 130000
+#include "access/tuptoaster.h"
+#else
 #include "access/heaptoast.h"
 #include "access/heaptoast.h"
+#endif
 #include "utils/memutils.h"
 
 typedef struct SmlSign {
 #include "utils/memutils.h"
 
 typedef struct SmlSign {
@@ -48,6 +52,10 @@ typedef char *BITVECP;
 
 #define GETENTRY(vec,pos) ((SmlSign *) DatumGetPointer((vec)->vector[(pos)].key))
 
 
 #define GETENTRY(vec,pos) ((SmlSign *) DatumGetPointer((vec)->vector[(pos)].key))
 
+#ifndef Abs
+#define Abs(x) abs(x)
+#endif
+
 /*
  * Fake IO
  */
 /*
  * Fake IO
  */
@@ -242,11 +250,12 @@ getHashedCache(void *cache)
                for(i=0;i<stat->nelems;i++)
                {
                        uint32  hash;
                for(i=0;i<stat->nelems;i++)
                {
                        uint32  hash;
+                       int             index;
 
                        hash = DatumGetUInt32(FunctionCall1Coll(&stat->info->hashFunc,
                                                                                                        DEFAULT_COLLATION_OID,
                                                                                                        stat->elems[i].datum));
 
                        hash = DatumGetUInt32(FunctionCall1Coll(&stat->info->hashFunc,
                                                                                                        DEFAULT_COLLATION_OID,
                                                                                                        stat->elems[i].datum));
-                       int             index = HASHVAL(hash);
+                       index = HASHVAL(hash);
 
                        stat->helems[i].hash = hash;
                        stat->helems[i].idfMin = stat->helems[i].idfMax = stat->elems[i].idf;   
 
                        stat->helems[i].hash = hash;
                        stat->helems[i].idfMin = stat->helems[i].idfMax = stat->elems[i].idf;   
@@ -425,7 +434,7 @@ Datum
 gsmlsign_decompress(PG_FUNCTION_ARGS)
 {
        GISTENTRY       *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
 gsmlsign_decompress(PG_FUNCTION_ARGS)
 {
        GISTENTRY       *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
-       SmlSign         *key =  (SmlSign*)DatumGetPointer(PG_DETOAST_DATUM(entry->key));
+       SmlSign         *key =  (SmlSign*)PG_DETOAST_DATUM(entry->key);
 
        if (key != (SmlSign *) DatumGetPointer(entry->key))
        {
 
        if (key != (SmlSign *) DatumGetPointer(entry->key))
        {