From 0c345af71969d9863bb76efa833391d00705669e Mon Sep 17 00:00:00 2001 From: Teodor Sigaev Date: Wed, 8 Apr 2020 12:53:09 +0300 Subject: [PATCH 1/4] v13 support --- smlar.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/smlar.c b/smlar.c index ce7e2ad..672e453 100644 --- a/smlar.c +++ b/smlar.c @@ -30,6 +30,10 @@ PG_MODULE_MAGIC; #define SNAPSHOT SnapshotNow #endif +#if PG_VERSION_NUM >= 130000 +#define heap_open(r, l) table_open((r), (l)) +#define heap_close(r, l) table_close((r), (l)) +#endif static Oid getDefaultOpclass(Oid amoid, Oid typid) -- 2.37.3 From 8a465bb03ae7e2e85c3f9e1ebd75eb4ec830f3c5 Mon Sep 17 00:00:00 2001 From: Teodor Sigaev Date: Thu, 8 Oct 2020 00:37:45 +0300 Subject: [PATCH 2/4] v13 support --- smlar_gin.c | 2 +- smlar_gist.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/smlar_gin.c b/smlar_gin.c index ec095f6..798b9be 100644 --- a/smlar_gin.c +++ b/smlar_gin.c @@ -5,7 +5,7 @@ #include "fmgr.h" #include "access/gin.h" #include "access/skey.h" -#include "access/tuptoaster.h" +#include "access/heaptoast.h" PG_FUNCTION_INFO_V1(smlararrayextract); Datum smlararrayextract(PG_FUNCTION_ARGS); diff --git a/smlar_gist.c b/smlar_gist.c index b1d9073..8cd044b 100644 --- a/smlar_gist.c +++ b/smlar_gist.c @@ -3,7 +3,7 @@ #include "fmgr.h" #include "access/gist.h" #include "access/skey.h" -#include "access/tuptoaster.h" +#include "access/heaptoast.h" #include "utils/memutils.h" typedef struct SmlSign { -- 2.37.3 From 25a4fef344f5c2b90e6a9d32144ee12b9198487d Mon Sep 17 00:00:00 2001 From: Teodor Sigaev Date: Thu, 8 Oct 2020 00:42:32 +0300 Subject: [PATCH 3/4] v13 + other support --- smlar_gin.c | 4 ++++ smlar_gist.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/smlar_gin.c b/smlar_gin.c index 798b9be..4164fa4 100644 --- a/smlar_gin.c +++ b/smlar_gin.c @@ -5,7 +5,11 @@ #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" +#endif PG_FUNCTION_INFO_V1(smlararrayextract); Datum smlararrayextract(PG_FUNCTION_ARGS); diff --git a/smlar_gist.c b/smlar_gist.c index 8cd044b..7d77788 100644 --- a/smlar_gist.c +++ b/smlar_gist.c @@ -3,7 +3,11 @@ #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" +#endif #include "utils/memutils.h" typedef struct SmlSign { -- 2.37.3 From f2522d5f20a46a3605a761d34a3aefcdffb94e71 Mon Sep 17 00:00:00 2001 From: Teodor Sigaev Date: Mon, 8 Nov 2021 14:49:14 +0300 Subject: [PATCH 4/4] Fix compiler warnings --- smlar.c | 1 + smlar_gist.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/smlar.c b/smlar.c index 672e453..ca0651f 100644 --- 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] )); + /* FALLTHROUGH */ case TF_N: s->df[i] *= stat->idf; break; diff --git a/smlar_gist.c b/smlar_gist.c index 7d77788..480d744 100644 --- a/smlar_gist.c +++ b/smlar_gist.c @@ -246,11 +246,12 @@ getHashedCache(void *cache) for(i=0;inelems;i++) { uint32 hash; + int index; 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; -- 2.37.3