From: Teodor Sigaev Date: Wed, 8 Apr 2020 09:46:05 +0000 (+0300) Subject: v12 support X-Git-Url: http://sigaev.ru/git/gitweb.cgi?a=commitdiff_plain;h=15c8b4b78d7ed329f52e520e824c68ae33748f8a;p=smlar.git v12 support --- diff --git a/expected/bit.out b/expected/bit.out index 980cbaf..fff8c6e 100644 --- a/expected/bit.out +++ b/expected/bit.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); set_smlar_limit ----------------- diff --git a/expected/bytea.out b/expected/bytea.out index 6e98885..2c3d4c9 100644 --- a/expected/bytea.out +++ b/expected/bytea.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); set_smlar_limit ----------------- diff --git a/expected/char.out b/expected/char.out index b754250..af7e037 100644 --- a/expected/char.out +++ b/expected/char.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); set_smlar_limit ----------------- diff --git a/expected/cidr.out b/expected/cidr.out index 38d1ad4..0313210 100644 --- a/expected/cidr.out +++ b/expected/cidr.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); set_smlar_limit ----------------- diff --git a/expected/composite_int4.out b/expected/composite_int4.out index fc1d243..1a46c08 100644 --- a/expected/composite_int4.out +++ b/expected/composite_int4.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); set_smlar_limit ----------------- diff --git a/expected/composite_text.out b/expected/composite_text.out index 0b77edc..4824934 100644 --- a/expected/composite_text.out +++ b/expected/composite_text.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); set_smlar_limit ----------------- diff --git a/expected/date.out b/expected/date.out index 10b7fe3..8801337 100644 --- a/expected/date.out +++ b/expected/date.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); set_smlar_limit ----------------- diff --git a/expected/float4.out b/expected/float4.out index 70eb507..f44cc0d 100644 --- a/expected/float4.out +++ b/expected/float4.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); set_smlar_limit ----------------- diff --git a/expected/float8.out b/expected/float8.out index 4a9286f..bff792c 100644 --- a/expected/float8.out +++ b/expected/float8.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); set_smlar_limit ----------------- diff --git a/expected/inet.out b/expected/inet.out index 7bde3d8..b7d47d0 100644 --- a/expected/inet.out +++ b/expected/inet.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); set_smlar_limit ----------------- diff --git a/expected/int2.out b/expected/int2.out index 8c43891..ed54190 100644 --- a/expected/int2.out +++ b/expected/int2.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); set_smlar_limit ----------------- diff --git a/expected/int4.out b/expected/int4.out index 1f69657..90f28ab 100644 --- a/expected/int4.out +++ b/expected/int4.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); set_smlar_limit ----------------- diff --git a/expected/int4g.out b/expected/int4g.out index fd234b5..433fcd7 100644 --- a/expected/int4g.out +++ b/expected/int4g.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.3); set_smlar_limit ----------------- diff --git a/expected/int4i.out b/expected/int4i.out index 81e8284..92a8246 100644 --- a/expected/int4i.out +++ b/expected/int4i.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(5.0); set_smlar_limit ----------------- diff --git a/expected/int8.out b/expected/int8.out index ee943d2..7fdaebe 100644 --- a/expected/int8.out +++ b/expected/int8.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); set_smlar_limit ----------------- diff --git a/expected/int8g.out b/expected/int8g.out index 432fa35..b38ba2c 100644 --- a/expected/int8g.out +++ b/expected/int8g.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.3); set_smlar_limit ----------------- diff --git a/expected/int8i.out b/expected/int8i.out index 9ffcc4d..201cf63 100644 --- a/expected/int8i.out +++ b/expected/int8i.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(5.0); set_smlar_limit ----------------- diff --git a/expected/interval.out b/expected/interval.out index a8bd2bd..1d33b6e 100644 --- a/expected/interval.out +++ b/expected/interval.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); set_smlar_limit ----------------- diff --git a/expected/intervalg.out b/expected/intervalg.out index 6731e3c..7122a90 100644 --- a/expected/intervalg.out +++ b/expected/intervalg.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.3); set_smlar_limit ----------------- diff --git a/expected/intervali.out b/expected/intervali.out index 9d34998..fd1f5b8 100644 --- a/expected/intervali.out +++ b/expected/intervali.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(5.0); set_smlar_limit ----------------- diff --git a/expected/macaddr.out b/expected/macaddr.out index 9397042..14cac5f 100644 --- a/expected/macaddr.out +++ b/expected/macaddr.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); set_smlar_limit ----------------- diff --git a/expected/money.out b/expected/money.out index c04d690..d3f4ae1 100644 --- a/expected/money.out +++ b/expected/money.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); set_smlar_limit ----------------- diff --git a/expected/numeric.out b/expected/numeric.out index 84eb7ee..cf8882f 100644 --- a/expected/numeric.out +++ b/expected/numeric.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); set_smlar_limit ----------------- diff --git a/expected/oid.out b/expected/oid.out index c76ce6f..ac67cf7 100644 --- a/expected/oid.out +++ b/expected/oid.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); set_smlar_limit ----------------- diff --git a/expected/smlar.out b/expected/smlar.out index 2a34641..5dac034 100644 --- a/expected/smlar.out +++ b/expected/smlar.out @@ -1,4 +1,5 @@ CREATE EXTENSION smlar; +set extra_float_digits =0; --sanity check SELECT opc.opcname, diff --git a/expected/text.out b/expected/text.out index 622a89e..56cbd36 100644 --- a/expected/text.out +++ b/expected/text.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); set_smlar_limit ----------------- diff --git a/expected/textg.out b/expected/textg.out index a48cb24..38fc578 100644 --- a/expected/textg.out +++ b/expected/textg.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.3); set_smlar_limit ----------------- diff --git a/expected/texti.out b/expected/texti.out index 751d140..b52ff23 100644 --- a/expected/texti.out +++ b/expected/texti.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(5.0); set_smlar_limit ----------------- diff --git a/expected/time.out b/expected/time.out index 2fe47ed..e724702 100644 --- a/expected/time.out +++ b/expected/time.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); set_smlar_limit ----------------- diff --git a/expected/timestamp.out b/expected/timestamp.out index 72ab686..3ef57c2 100644 --- a/expected/timestamp.out +++ b/expected/timestamp.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); set_smlar_limit ----------------- diff --git a/expected/timestamptz.out b/expected/timestamptz.out index a73c451..a5dc890 100644 --- a/expected/timestamptz.out +++ b/expected/timestamptz.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); set_smlar_limit ----------------- diff --git a/expected/timetz.out b/expected/timetz.out index cd5191d..d0fa0e9 100644 --- a/expected/timetz.out +++ b/expected/timetz.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); set_smlar_limit ----------------- diff --git a/expected/varbit.out b/expected/varbit.out index 06332ab..6f614d8 100644 --- a/expected/varbit.out +++ b/expected/varbit.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); set_smlar_limit ----------------- diff --git a/expected/varchar.out b/expected/varchar.out index 9fab6c4..f74b110 100644 --- a/expected/varchar.out +++ b/expected/varchar.out @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); set_smlar_limit ----------------- diff --git a/smlar.c b/smlar.c index 13c8169..ce7e2ad 100644 --- a/smlar.c +++ b/smlar.c @@ -16,7 +16,9 @@ #include "utils/fmgroids.h" #include "utils/lsyscache.h" #include "utils/memutils.h" +#if (PG_VERSION_NUM < 120000) #include "utils/tqual.h" +#endif #include "utils/syscache.h" #include "utils/typcache.h" @@ -28,6 +30,7 @@ PG_MODULE_MAGIC; #define SNAPSHOT SnapshotNow #endif + static Oid getDefaultOpclass(Oid amoid, Oid typid) { @@ -56,7 +59,11 @@ getDefaultOpclass(Oid amoid, Oid typid) { if ( OidIsValid(opclassOid) ) elog(ERROR, "Ambiguous opclass for type %u (access method %u)", typid, amoid); +#if (PG_VERSION_NUM >= 120000) + opclassOid = opclass->oid; +#else opclassOid = HeapTupleGetOid(tuple); +#endif } } diff --git a/smlar_gist.c b/smlar_gist.c index 788876c..b1d9073 100644 --- a/smlar_gist.c +++ b/smlar_gist.c @@ -164,7 +164,9 @@ Array2HashedArray(ProcTypeInfo info, ArrayType *a) ptr = GETARR(sign); for(i=0;inelems;i++) - ptr[i] = DatumGetUInt32( FunctionCall1( &s->info->hashFunc, s->elems[i] ) ); + ptr[i] = DatumGetUInt32(FunctionCall1Coll(&s->info->hashFunc, + DEFAULT_COLLATION_OID, + s->elems[i])); /* * there is a collision of hash-function; len is always equal or less than @@ -239,7 +241,11 @@ getHashedCache(void *cache) getFmgrInfoHash(stat->info); for(i=0;inelems;i++) { - uint32 hash = DatumGetUInt32( FunctionCall1( &stat->info->hashFunc, stat->elems[i].datum ) ); + uint32 hash; + + hash = DatumGetUInt32(FunctionCall1Coll(&stat->info->hashFunc, + DEFAULT_COLLATION_OID, + stat->elems[i].datum)); int index = HASHVAL(hash); stat->helems[i].hash = hash; @@ -296,7 +302,9 @@ fillHashVal(void *cache, SimpleArray *a) getFmgrInfoHash(a->info); for(i=0;inelems;i++) - a->hash[i] = DatumGetUInt32( FunctionCall1( &a->info->hashFunc, a->elems[i] ) ); + a->hash[i] = DatumGetUInt32(FunctionCall1Coll(&a->info->hashFunc, + DEFAULT_COLLATION_OID, + a->elems[i])); } diff --git a/sql/bit.sql b/sql/bit.sql index 028268a..1669561 100644 --- a/sql/bit.sql +++ b/sql/bit.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); SELECT diff --git a/sql/bytea.sql b/sql/bytea.sql index e86d6cb..952aa74 100644 --- a/sql/bytea.sql +++ b/sql/bytea.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); SELECT diff --git a/sql/char.sql b/sql/char.sql index 9a39f66..b557da9 100644 --- a/sql/char.sql +++ b/sql/char.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); SELECT diff --git a/sql/cidr.sql b/sql/cidr.sql index afe69d4..d8ff861 100644 --- a/sql/cidr.sql +++ b/sql/cidr.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); SELECT diff --git a/sql/composite_int4.sql b/sql/composite_int4.sql index 0ba908f..aab069b 100644 --- a/sql/composite_int4.sql +++ b/sql/composite_int4.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); CREATE TYPE cint AS (id int, w float4); diff --git a/sql/composite_text.sql b/sql/composite_text.sql index 6c0b85d..2f41ff8 100644 --- a/sql/composite_text.sql +++ b/sql/composite_text.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); CREATE TYPE ctext AS (id text, w float4); diff --git a/sql/date.sql b/sql/date.sql index 8643579..219122c 100644 --- a/sql/date.sql +++ b/sql/date.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); SELECT diff --git a/sql/float4.sql b/sql/float4.sql index 53668e9..09343c4 100644 --- a/sql/float4.sql +++ b/sql/float4.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); SELECT diff --git a/sql/float8.sql b/sql/float8.sql index 3841941..3753a42 100644 --- a/sql/float8.sql +++ b/sql/float8.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); SELECT diff --git a/sql/inet.sql b/sql/inet.sql index 22febf6..7aaa2f1 100644 --- a/sql/inet.sql +++ b/sql/inet.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); SELECT diff --git a/sql/int2.sql b/sql/int2.sql index c55464d..e3e913c 100644 --- a/sql/int2.sql +++ b/sql/int2.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); SELECT diff --git a/sql/int4.sql b/sql/int4.sql index 2b16272..4a31600 100644 --- a/sql/int4.sql +++ b/sql/int4.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); SELECT diff --git a/sql/int4g.sql b/sql/int4g.sql index 982ce4d..e7d4f09 100644 --- a/sql/int4g.sql +++ b/sql/int4g.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.3); SET smlar.type = "tfidf"; diff --git a/sql/int4i.sql b/sql/int4i.sql index 58e9b0d..7a9d58d 100644 --- a/sql/int4i.sql +++ b/sql/int4i.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(5.0); SET smlar.type='overlap'; diff --git a/sql/int8.sql b/sql/int8.sql index 9b3e2be..8ea868c 100644 --- a/sql/int8.sql +++ b/sql/int8.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); SELECT diff --git a/sql/int8g.sql b/sql/int8g.sql index 4449e32..f7262ef 100644 --- a/sql/int8g.sql +++ b/sql/int8g.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.3); SET smlar.type = "tfidf"; diff --git a/sql/int8i.sql b/sql/int8i.sql index ad458e4..b74a464 100644 --- a/sql/int8i.sql +++ b/sql/int8i.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(5.0); SET smlar.type='overlap'; diff --git a/sql/int8n.sql b/sql/int8n.sql index 81144c9..957288e 100644 --- a/sql/int8n.sql +++ b/sql/int8n.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.8); DROP INDEX idx_test_int8; diff --git a/sql/interval.sql b/sql/interval.sql index 7b45c95..8611a7c 100644 --- a/sql/interval.sql +++ b/sql/interval.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); SELECT diff --git a/sql/intervalg.sql b/sql/intervalg.sql index 5bc25ca..f41394b 100644 --- a/sql/intervalg.sql +++ b/sql/intervalg.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.3); SET smlar.type = "tfidf"; diff --git a/sql/intervali.sql b/sql/intervali.sql index 2287d1a..335ab36 100644 --- a/sql/intervali.sql +++ b/sql/intervali.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(5.0); SET smlar.type='overlap'; diff --git a/sql/intervaln.sql b/sql/intervaln.sql index f36759d..2e03e0d 100644 --- a/sql/intervaln.sql +++ b/sql/intervaln.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.8); DROP INDEX idx_test_interval; diff --git a/sql/macaddr.sql b/sql/macaddr.sql index 92492c8..9b36359 100644 --- a/sql/macaddr.sql +++ b/sql/macaddr.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); SELECT diff --git a/sql/money.sql b/sql/money.sql index 43ea5ae..f280e0b 100644 --- a/sql/money.sql +++ b/sql/money.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); SELECT diff --git a/sql/numeric.sql b/sql/numeric.sql index 5b54b2d..04626f0 100644 --- a/sql/numeric.sql +++ b/sql/numeric.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); SELECT diff --git a/sql/oid.sql b/sql/oid.sql index 2436a32..3c3d5ae 100644 --- a/sql/oid.sql +++ b/sql/oid.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); SELECT diff --git a/sql/smlar.sql b/sql/smlar.sql index da93dfe..c498675 100644 --- a/sql/smlar.sql +++ b/sql/smlar.sql @@ -1,4 +1,5 @@ CREATE EXTENSION smlar; +set extra_float_digits =0; --sanity check SELECT diff --git a/sql/text.sql b/sql/text.sql index 98cac43..c160920 100644 --- a/sql/text.sql +++ b/sql/text.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); SELECT diff --git a/sql/textg.sql b/sql/textg.sql index c937a5b..e8d2575 100644 --- a/sql/textg.sql +++ b/sql/textg.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.3); SET smlar.type = "tfidf"; diff --git a/sql/texti.sql b/sql/texti.sql index ea974b7..96833e6 100644 --- a/sql/texti.sql +++ b/sql/texti.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(5.0); SET smlar.type='overlap'; diff --git a/sql/textn.sql b/sql/textn.sql index dd6e65e..b3f1ae8 100644 --- a/sql/textn.sql +++ b/sql/textn.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.8); DROP INDEX idx_test_text; diff --git a/sql/time.sql b/sql/time.sql index 81360e7..9218a59 100644 --- a/sql/time.sql +++ b/sql/time.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); SELECT diff --git a/sql/timestamp.sql b/sql/timestamp.sql index f85a310..736e0b8 100644 --- a/sql/timestamp.sql +++ b/sql/timestamp.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); SELECT diff --git a/sql/timestamptz.sql b/sql/timestamptz.sql index 8e9081f..e2a8687 100644 --- a/sql/timestamptz.sql +++ b/sql/timestamptz.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); SELECT diff --git a/sql/timetz.sql b/sql/timetz.sql index c3e18f3..8d47bab 100644 --- a/sql/timetz.sql +++ b/sql/timetz.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); SELECT diff --git a/sql/varbit.sql b/sql/varbit.sql index 23c3b5c..4389dfe 100644 --- a/sql/varbit.sql +++ b/sql/varbit.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); SELECT diff --git a/sql/varchar.sql b/sql/varchar.sql index fe6c720..9faaf32 100644 --- a/sql/varchar.sql +++ b/sql/varchar.sql @@ -1,3 +1,4 @@ +set extra_float_digits =0; SELECT set_smlar_limit(0.6); SELECT