Skip to content

Commit

Permalink
modification for pg 16, but still an error in ltree_gist.c for pg16
Browse files Browse the repository at this point in the history
  • Loading branch information
PerikAdjust committed Jun 18, 2024
1 parent 2eb79da commit a38ac37
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ jobs:
test:
strategy:
matrix:
pg: [16, 15, 14, 13, 12, 11, 10]
pg: [15]
#pg: [16, 15, 14, 13, 12, 11, 10]
name: 🐘 PostgreSQL ${{ matrix.pg }}
runs-on: ubuntu-latest
container: pgxn/pgxn-tools
Expand Down
8 changes: 6 additions & 2 deletions _ltree_gist.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
#include "access/skey.h"
#include "crc32.h"
#include "ltree.h"
#if PG_VERSION_NUM >= 160000
#include "varatt.h"
#include "utils/array.h"
#endif


PG_FUNCTION_INFO_V1(_ltree_compress);
Expand Down Expand Up @@ -378,7 +382,7 @@ _ltree_picksplit(PG_FUNCTION_ARGS)
_j = GETENTRY(entryvec, j);
size_alpha = hemdist(datum_l, _j);
size_beta = hemdist(datum_r, _j);
costvector[j - 1].cost = Abs(size_alpha - size_beta);
costvector[j - 1].cost = abs(size_alpha - size_beta);
}
qsort((void *) costvector, maxoff, sizeof(SPLITCOST), comparecost);

Expand Down Expand Up @@ -556,7 +560,7 @@ Datum
_ltree_consistent(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
char *query = (char *) DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(1)));
char *query = (char *) DatumGetPointer(PG_GETARG_DATUM(1));
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);

/* Oid subtype = PG_GETARG_OID(3); */
Expand Down
4 changes: 4 additions & 0 deletions _ltree_op.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
* Teodor Sigaev <[email protected]>
*/
#include "postgres.h"
#if PG_VERSION_NUM >= 160000
#include "utils/array.h"
#endif


#include <ctype.h>

Expand Down
2 changes: 1 addition & 1 deletion lquery_op.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "utils/formatting.h"
#include "ltree.h"
#if PG_VERSION_NUM >= 160000
#include "varatt.h"
#include "utils/array.h"
#endif

PG_FUNCTION_INFO_V1(ltq_regex);
Expand Down
10 changes: 8 additions & 2 deletions ltree_gist.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
#include "crc32.h"
#include "ltree.h"

#if PG_VERSION_NUM >= 160000
#include "varatt.h"
#include "utils/array.h"
#endif

#define NEXTVAL(x) ( (lquery*)( (char*)(x) + INTALIGN( VARSIZE(x) ) ) )

PG_FUNCTION_INFO_V1(ltree_gist_in);
Expand Down Expand Up @@ -70,6 +75,7 @@ ltree_compress(PG_FUNCTION_ARGS)
{ /* ltree */
ltree_gist *key;
ltree *val = (ltree *) DatumGetPointer(PG_DETOAST_DATUM(entry->key));
// ltree *val = DatumGetLtreeP(entry->key);
int4 len = LTG_HDRSIZE + VARSIZE(val);

key = (ltree_gist *) palloc(len);
Expand All @@ -89,7 +95,7 @@ Datum
ltree_decompress(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
ltree_gist *key = (ltree_gist *) DatumGetPointer(PG_DETOAST_DATUM(entry->key));
ltree_gist *key = (ltree_gist *) PG_DETOAST_DATUM(entry->key);

if (PointerGetDatum(key) != entry->key)
{
Expand Down Expand Up @@ -707,7 +713,7 @@ ltree_consistent(PG_FUNCTION_ARGS)
break;
case 16:
case 17:
query = DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(1)));
query = PG_GETARG_ARRAYTYPE_P(1);
if (GIST_LEAF(entry))
res = DatumGetBool(DirectFunctionCall2(lt_q_regex,
PointerGetDatum(LTG_NODE(key)),
Expand Down
3 changes: 3 additions & 0 deletions ltxtquery_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

#include "crc32.h"
#include "ltree.h"
#if PG_VERSION_NUM >= 160000
#include "varatt.h"
#endif

PG_FUNCTION_INFO_V1(ltxtq_in);
Datum ltxtq_in(PG_FUNCTION_ARGS);
Expand Down
Binary file added wltree.dylib
Binary file not shown.

0 comments on commit a38ac37

Please sign in to comment.