On 08.12.25 11:53, Chao Li wrote:
On Dec 8, 2025, at 18:25, David Geier <[email protected]> wrote:
Hi Peter,
I went with your proposal of GinExtraPointer. See attached patch. It's
based on the series of patches from Peter's initial mail. I've included
the removal of the Pointer typedef in the same patch.
It seems to me that we reached agreement. Are you planning to still
apply these patches?
Basically I am not against this patch, as
756a43689324b473ee07549a6eb7a53a203df5ad has done similar changes.
What I want to understand is that why do we delete Pointer and add
GinExtraPointer?
```
-/*
- * Pointer
- * Variable holding address of any memory resident object.
- * (obsolescent; use void * or char *)
- */
-typedef void *Pointer;
```
And
```
+typedef void *GinExtraPointer;
```
They both are underlying “void *”. Are we expecting to improve code
readability? More specific maybe?
I was planning to proceed with Dagfinn's patch set. Here is what is
currently remaining of the patch series. I haven't fully processed
everyone's comments in this thread, so they might not be reflected in
these patches.
There is some interference from the changes from palloc to
palloc_object/_array/etc., and I was also trying to figure out what to
do with the commented out code, hence the delay.
From 32d2ac63d30532096467a8579f4034a63718150a Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <[email protected]>
Date: Mon, 24 Nov 2025 11:02:35 +0100
Subject: [PATCH v2 1/2] Remove some uses of the Pointer type
everywhere except GIN
Reviewed-by: Chao Li <[email protected]>
Reviewed-by: Bertrand Drouvot <[email protected]>
Discussion:
https://www.postgresql.org/message-id/4154950a-47ae-4223-bd01-1235cc50e933%40eisentraut.org
---
contrib/amcheck/verify_heapam.c | 2 +-
src/backend/access/common/heaptuple.c | 2 +-
src/backend/access/common/toast_internals.c | 2 +-
src/backend/access/heap/heaptoast.c | 2 +-
src/backend/nodes/tidbitmap.c | 4 ++--
src/backend/replication/logical/reorderbuffer.c | 4 ++--
src/backend/utils/adt/rangetypes.c | 6 +++---
src/bin/initdb/initdb.c | 4 ++--
src/include/postgres.h | 4 ++--
9 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/contrib/amcheck/verify_heapam.c b/contrib/amcheck/verify_heapam.c
index a090e18c697..7cf58db20ef 100644
--- a/contrib/amcheck/verify_heapam.c
+++ b/contrib/amcheck/verify_heapam.c
@@ -1557,7 +1557,7 @@ check_toast_tuple(HeapTuple toasttup, HeapCheckContext
*ctx,
{
int32 chunk_seq;
int32 last_chunk_seq = (extsize - 1) / TOAST_MAX_CHUNK_SIZE;
- Pointer chunk;
+ void *chunk;
bool isnull;
int32 chunksize;
int32 expected_size;
diff --git a/src/backend/access/common/heaptuple.c
b/src/backend/access/common/heaptuple.c
index 1967b047020..062aadacb12 100644
--- a/src/backend/access/common/heaptuple.c
+++ b/src/backend/access/common/heaptuple.c
@@ -321,7 +321,7 @@ fill_val(CompactAttribute *att,
else if (att->attlen == -1)
{
/* varlena */
- Pointer val = DatumGetPointer(datum);
+ void *val = DatumGetPointer(datum);
*infomask |= HEAP_HASVARWIDTH;
if (VARATT_IS_EXTERNAL(val))
diff --git a/src/backend/access/common/toast_internals.c
b/src/backend/access/common/toast_internals.c
index 63b848473f8..ba6ef6f4e72 100644
--- a/src/backend/access/common/toast_internals.c
+++ b/src/backend/access/common/toast_internals.c
@@ -128,7 +128,7 @@ toast_save_datum(Relation rel, Datum value,
int32 chunk_seq = 0;
char *data_p;
int32 data_todo;
- Pointer dval = DatumGetPointer(value);
+ void *dval = DatumGetPointer(value);
int num_indexes;
int validIndex;
diff --git a/src/backend/access/heap/heaptoast.c
b/src/backend/access/heap/heaptoast.c
index 60e765fbfce..a049d7c7e81 100644
--- a/src/backend/access/heap/heaptoast.c
+++ b/src/backend/access/heap/heaptoast.c
@@ -696,7 +696,7 @@ heap_fetch_toast_slice(Relation toastrel, Oid valueid,
int32 attrsize,
while ((ttup = systable_getnext_ordered(toastscan,
ForwardScanDirection)) != NULL)
{
int32 curchunk;
- Pointer chunk;
+ void *chunk;
bool isnull;
char *chunkdata;
int32 chunksize;
diff --git a/src/backend/nodes/tidbitmap.c b/src/backend/nodes/tidbitmap.c
index 1f83d0d55f5..0d11ec001c1 100644
--- a/src/backend/nodes/tidbitmap.c
+++ b/src/backend/nodes/tidbitmap.c
@@ -1546,11 +1546,11 @@ tbm_calculate_entries(Size maxbytes)
/*
* Estimate number of hashtable entries we can have within maxbytes.
This
* estimates the hash cost as sizeof(PagetableEntry), which is good
enough
- * for our purpose. Also count an extra Pointer per entry for the
arrays
+ * for our purpose. Also count an extra pointer per entry for the
arrays
* created during iteration readout.
*/
nbuckets = maxbytes /
- (sizeof(PagetableEntry) + sizeof(Pointer) + sizeof(Pointer));
+ (sizeof(PagetableEntry) + sizeof(void *) + sizeof(void *));
nbuckets = Min(nbuckets, INT_MAX - 1); /* safety limit */
nbuckets = Max(nbuckets, 16); /* sanity limit */
diff --git a/src/backend/replication/logical/reorderbuffer.c
b/src/backend/replication/logical/reorderbuffer.c
index eb6a84554b7..a014ef72aca 100644
--- a/src/backend/replication/logical/reorderbuffer.c
+++ b/src/backend/replication/logical/reorderbuffer.c
@@ -5003,7 +5003,7 @@ ReorderBufferToastAppendChunk(ReorderBuffer *rb,
ReorderBufferTXN *txn,
bool found;
int32 chunksize;
bool isnull;
- Pointer chunk;
+ void *chunk;
TupleDesc desc = RelationGetDescr(relation);
Oid chunk_id;
int32 chunk_seq;
@@ -5192,7 +5192,7 @@ ReorderBufferToastReplace(ReorderBuffer *rb,
ReorderBufferTXN *txn,
bool cisnull;
ReorderBufferChange *cchange;
HeapTuple ctup;
- Pointer chunk;
+ void *chunk;
cchange = dlist_container(ReorderBufferChange, node,
it.cur);
ctup = cchange->data.tp.newtuple;
diff --git a/src/backend/utils/adt/rangetypes.c
b/src/backend/utils/adt/rangetypes.c
index d8e5130d642..b887f21f10e 100644
--- a/src/backend/utils/adt/rangetypes.c
+++ b/src/backend/utils/adt/rangetypes.c
@@ -1962,7 +1962,7 @@ range_serialize(TypeCacheEntry *typcache, RangeBound
*lower, RangeBound *upper,
RangeType *range;
int cmp;
Size msize;
- Pointer ptr;
+ char *ptr;
int16 typlen;
bool typbyval;
char typalign;
@@ -2070,7 +2070,7 @@ range_serialize(TypeCacheEntry *typcache, RangeBound
*lower, RangeBound *upper,
typstorage);
}
- *((char *) ptr) = flags;
+ *ptr = flags;
return range;
}
@@ -2953,7 +2953,7 @@ datum_write(char *ptr, Datum datum, bool typbyval, char
typalign,
else if (typlen == -1)
{
/* varlena */
- Pointer val = DatumGetPointer(datum);
+ void *val = DatumGetPointer(datum);
if (VARATT_IS_EXTERNAL(val))
{
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 92fe2f531f7..30fce0d5f37 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -1574,11 +1574,11 @@ bootstrap_template1(void)
sprintf(buf, "%d", NAMEDATALEN);
bki_lines = replace_token(bki_lines, "NAMEDATALEN", buf);
- sprintf(buf, "%d", (int) sizeof(Pointer));
+ sprintf(buf, "%d", (int) sizeof(void *));
bki_lines = replace_token(bki_lines, "SIZEOF_POINTER", buf);
bki_lines = replace_token(bki_lines, "ALIGNOF_POINTER",
- (sizeof(Pointer) ==
4) ? "i" : "d");
+ (sizeof(void *) == 4)
? "i" : "d");
bki_lines = replace_token(bki_lines, "POSTGRES",
escape_quotes_bki(username));
diff --git a/src/include/postgres.h b/src/include/postgres.h
index 357cbd6fd96..5f1c6b0a79e 100644
--- a/src/include/postgres.h
+++ b/src/include/postgres.h
@@ -318,10 +318,10 @@ CommandIdGetDatum(CommandId X)
* DatumGetPointer
* Returns pointer value of a datum.
*/
-static inline Pointer
+static inline void *
DatumGetPointer(Datum X)
{
- return (Pointer) (uintptr_t) X;
+ return (void *) (uintptr_t) X;
}
/*
--
2.52.0
From 343c866e127f66cad692767bfff76bef6aa9f3b0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= <[email protected]>
Date: Mon, 24 Nov 2025 20:05:38 +0000
Subject: [PATCH v2 2/2] Convert remaning uses of Pointer to void *
Also remove redundant casts of the modified variables (except
PG_GETARG_POINTER()), and change a nearby char * to void *.
---
contrib/amcheck/verify_gin.c | 2 +-
contrib/btree_gin/btree_gin.c | 6 +++---
contrib/hstore/hstore_gin.c | 2 +-
contrib/intarray/_int_gin.c | 2 +-
contrib/pg_trgm/trgm_gin.c | 12 ++++++------
src/backend/access/gin/ginarrayproc.c | 6 +++---
src/backend/access/gin/ginentrypage.c | 6 +++---
src/backend/access/gin/ginscan.c | 8 ++++----
src/backend/utils/adt/jsonb_gin.c | 16 ++++++++--------
src/backend/utils/adt/selfuncs.c | 2 +-
src/backend/utils/adt/tsginidx.c | 16 ++++++++--------
src/include/access/gin_private.h | 6 +++---
src/include/access/ginblock.h | 2 +-
13 files changed, 43 insertions(+), 43 deletions(-)
diff --git a/contrib/amcheck/verify_gin.c b/contrib/amcheck/verify_gin.c
index 253da4b1f0b..2ec941661d6 100644
--- a/contrib/amcheck/verify_gin.c
+++ b/contrib/amcheck/verify_gin.c
@@ -98,7 +98,7 @@ gin_index_check(PG_FUNCTION_ARGS)
static ItemPointer
ginReadTupleWithoutState(IndexTuple itup, int *nitems)
{
- Pointer ptr = GinGetPosting(itup);
+ void *ptr = GinGetPosting(itup);
int nipd = GinGetNPosting(itup);
ItemPointer ipd;
int ndecoded;
diff --git a/contrib/btree_gin/btree_gin.c b/contrib/btree_gin/btree_gin.c
index afb8b3820af..363202a359e 100644
--- a/contrib/btree_gin/btree_gin.c
+++ b/contrib/btree_gin/btree_gin.c
@@ -74,7 +74,7 @@ gin_btree_extract_query(FunctionCallInfo fcinfo,
int32 *nentries = (int32 *) PG_GETARG_POINTER(1);
StrategyNumber strategy = PG_GETARG_UINT16(2);
bool **partialmatch = (bool **) PG_GETARG_POINTER(3);
- Pointer **extra_data = (Pointer **) PG_GETARG_POINTER(4);
+ void ***extra_data = (void ***) PG_GETARG_POINTER(4);
Datum *entries = palloc_object(Datum);
QueryInfo *data = palloc_object(QueryInfo);
bool *ptr_partialmatch = palloc_object(bool);
@@ -140,8 +140,8 @@ gin_btree_extract_query(FunctionCallInfo fcinfo,
data->orig_datum = datum;
data->entry_datum = entries[0];
data->typecmp = cmp_fns[rhs_code];
- *extra_data = palloc_object(Pointer);
- **extra_data = (Pointer) data;
+ *extra_data = palloc_object(void *);
+ **extra_data = data;
PG_RETURN_POINTER(entries);
}
diff --git a/contrib/hstore/hstore_gin.c b/contrib/hstore/hstore_gin.c
index 2e5fa115924..4b446f4d9e3 100644
--- a/contrib/hstore/hstore_gin.c
+++ b/contrib/hstore/hstore_gin.c
@@ -156,7 +156,7 @@ gin_consistent_hstore(PG_FUNCTION_ARGS)
/* HStore *query = PG_GETARG_HSTORE_P(2); */
int32 nkeys = PG_GETARG_INT32(3);
- /* Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4); */
+ /* void **extra_data = (void **) PG_GETARG_POINTER(4); */
bool *recheck = (bool *) PG_GETARG_POINTER(5);
bool res = true;
int32 i;
diff --git a/contrib/intarray/_int_gin.c b/contrib/intarray/_int_gin.c
index c60616c3f77..dffdd3fd681 100644
--- a/contrib/intarray/_int_gin.c
+++ b/contrib/intarray/_int_gin.c
@@ -113,7 +113,7 @@ ginint4_consistent(PG_FUNCTION_ARGS)
StrategyNumber strategy = PG_GETARG_UINT16(1);
int32 nkeys = PG_GETARG_INT32(3);
- /* Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4); */
+ /* void **extra_data = (void **) PG_GETARG_POINTER(4); */
bool *recheck = (bool *) PG_GETARG_POINTER(5);
bool res = false;
int32 i;
diff --git a/contrib/pg_trgm/trgm_gin.c b/contrib/pg_trgm/trgm_gin.c
index 66ff6adde99..8eaf5d58820 100644
--- a/contrib/pg_trgm/trgm_gin.c
+++ b/contrib/pg_trgm/trgm_gin.c
@@ -74,7 +74,7 @@ gin_extract_query_trgm(PG_FUNCTION_ARGS)
StrategyNumber strategy = PG_GETARG_UINT16(2);
/* bool **pmatch = (bool **) PG_GETARG_POINTER(3); */
- Pointer **extra_data = (Pointer **) PG_GETARG_POINTER(4);
+ void ***extra_data = (void ***) PG_GETARG_POINTER(4);
/* bool **nullFlags = (bool **) PG_GETARG_POINTER(5); */
int32 *searchMode = (int32 *) PG_GETARG_POINTER(6);
@@ -120,12 +120,12 @@ gin_extract_query_trgm(PG_FUNCTION_ARGS)
/*
* Successful regex processing: store NFA-like
graph as
* extra_data. GIN API requires an array of
nentries
- * Pointers, but we just put the same value in
each element.
+ * pointers, but we just put the same value in
each element.
*/
trglen = ARRNELEM(trg);
- *extra_data = palloc_array(Pointer, trglen);
+ *extra_data = palloc_array(void *, trglen);
for (i = 0; i < trglen; i++)
- (*extra_data)[i] = (Pointer) graph;
+ (*extra_data)[i] = graph;
}
else
{
@@ -174,7 +174,7 @@ gin_trgm_consistent(PG_FUNCTION_ARGS)
/* text *query = PG_GETARG_TEXT_PP(2); */
int32 nkeys = PG_GETARG_INT32(3);
- Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
+ void **extra_data = (void **) PG_GETARG_POINTER(4);
bool *recheck = (bool *) PG_GETARG_POINTER(5);
bool res;
int32 i,
@@ -272,7 +272,7 @@ gin_trgm_triconsistent(PG_FUNCTION_ARGS)
/* text *query = PG_GETARG_TEXT_PP(2); */
int32 nkeys = PG_GETARG_INT32(3);
- Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
+ void **extra_data = (void **) PG_GETARG_POINTER(4);
GinTernaryValue res = GIN_MAYBE;
int32 i,
ntrue;
diff --git a/src/backend/access/gin/ginarrayproc.c
b/src/backend/access/gin/ginarrayproc.c
index 1f821323eb0..eaeb8feb3a9 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -84,7 +84,7 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
StrategyNumber strategy = PG_GETARG_UINT16(2);
/* bool **pmatch = (bool **) PG_GETARG_POINTER(3); */
- /* Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4); */
+ /* void **extra_data = (void **) PG_GETARG_POINTER(4); */
bool **nullFlags = (bool **) PG_GETARG_POINTER(5);
int32 *searchMode = (int32 *) PG_GETARG_POINTER(6);
int16 elmlen;
@@ -147,7 +147,7 @@ ginarrayconsistent(PG_FUNCTION_ARGS)
/* ArrayType *query = PG_GETARG_ARRAYTYPE_P(2); */
int32 nkeys = PG_GETARG_INT32(3);
- /* Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4); */
+ /* void **extra_data = (void **) PG_GETARG_POINTER(4); */
bool *recheck = (bool *) PG_GETARG_POINTER(5);
/* Datum *queryKeys = (Datum *) PG_GETARG_POINTER(6); */
@@ -231,7 +231,7 @@ ginarraytriconsistent(PG_FUNCTION_ARGS)
/* ArrayType *query = PG_GETARG_ARRAYTYPE_P(2); */
int32 nkeys = PG_GETARG_INT32(3);
- /* Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4); */
+ /* void **extra_data = (void **) PG_GETARG_POINTER(4); */
/* Datum *queryKeys = (Datum *) PG_GETARG_POINTER(5); */
bool *nullFlags = (bool *) PG_GETARG_POINTER(6);
GinTernaryValue res;
diff --git a/src/backend/access/gin/ginentrypage.c
b/src/backend/access/gin/ginentrypage.c
index 94f49d72a98..6be7b3ffcd1 100644
--- a/src/backend/access/gin/ginentrypage.c
+++ b/src/backend/access/gin/ginentrypage.c
@@ -43,7 +43,7 @@ static void entrySplitPage(GinBtree btree, Buffer origbuf,
IndexTuple
GinFormTuple(GinState *ginstate,
OffsetNumber attnum, Datum key, GinNullCategory
category,
- Pointer data, Size dataSize, int nipd,
+ void *data, Size dataSize, int nipd,
bool errorTooBig)
{
Datum datums[2];
@@ -136,7 +136,7 @@ GinFormTuple(GinState *ginstate,
*/
if (data)
{
- char *ptr = GinGetPosting(itup);
+ void *ptr = GinGetPosting(itup);
memcpy(ptr, data, dataSize);
}
@@ -162,7 +162,7 @@ ItemPointer
ginReadTuple(GinState *ginstate, OffsetNumber attnum, IndexTuple itup,
int *nitems)
{
- Pointer ptr = GinGetPosting(itup);
+ void *ptr = GinGetPosting(itup);
int nipd = GinGetNPosting(itup);
ItemPointer ipd;
int ndecoded;
diff --git a/src/backend/access/gin/ginscan.c b/src/backend/access/gin/ginscan.c
index 26081693383..5aec1943ece 100644
--- a/src/backend/access/gin/ginscan.c
+++ b/src/backend/access/gin/ginscan.c
@@ -57,7 +57,7 @@ static GinScanEntry
ginFillScanEntry(GinScanOpaque so, OffsetNumber attnum,
StrategyNumber strategy, int32 searchMode,
Datum queryKey, GinNullCategory queryCategory,
- bool isPartialMatch, Pointer extra_data)
+ bool isPartialMatch, void *extra_data)
{
GinState *ginstate = &so->ginstate;
GinScanEntry scanEntry;
@@ -160,7 +160,7 @@ ginFillScanKey(GinScanOpaque so, OffsetNumber attnum,
StrategyNumber strategy, int32 searchMode,
Datum query, uint32 nQueryValues,
Datum *queryValues, GinNullCategory *queryCategories,
- bool *partial_matches, Pointer *extra_data)
+ bool *partial_matches, void **extra_data)
{
GinScanKey key = &(so->keys[so->nkeys++]);
GinState *ginstate = &so->ginstate;
@@ -206,7 +206,7 @@ ginFillScanKey(GinScanOpaque so, OffsetNumber attnum,
Datum queryKey;
GinNullCategory queryCategory;
bool isPartialMatch;
- Pointer this_extra;
+ void *this_extra;
queryKey = queryValues[i];
queryCategory = queryCategories[i];
@@ -302,7 +302,7 @@ ginNewScanKey(IndexScanDesc scan)
Datum *queryValues;
int32 nQueryValues = 0;
bool *partial_matches = NULL;
- Pointer *extra_data = NULL;
+ void **extra_data = NULL;
bool *nullFlags = NULL;
GinNullCategory *categories;
int32 searchMode = GIN_SEARCH_MODE_DEFAULT;
diff --git a/src/backend/utils/adt/jsonb_gin.c
b/src/backend/utils/adt/jsonb_gin.c
index a6d3332bb42..670e1520e8e 100644
--- a/src/backend/utils/adt/jsonb_gin.c
+++ b/src/backend/utils/adt/jsonb_gin.c
@@ -746,7 +746,7 @@ emit_jsp_gin_entries(JsonPathGinNode *node, GinEntries
*entries)
*/
static Datum *
extract_jsp_query(JsonPath *jp, StrategyNumber strat, bool pathOps,
- int32 *nentries, Pointer **extra_data)
+ int32 *nentries, void ***extra_data)
{
JsonPathGinContext cxt;
JsonPathItem root;
@@ -786,7 +786,7 @@ extract_jsp_query(JsonPath *jp, StrategyNumber strat, bool
pathOps,
return NULL;
*extra_data = palloc0(sizeof(**extra_data) * entries.count);
- **extra_data = (Pointer) node;
+ **extra_data = node;
return entries.buf;
}
@@ -909,7 +909,7 @@ gin_extract_jsonb_query(PG_FUNCTION_ARGS)
strategy == JsonbJsonpathExistsStrategyNumber)
{
JsonPath *jp = PG_GETARG_JSONPATH_P(0);
- Pointer **extra_data = (Pointer **) PG_GETARG_POINTER(4);
+ void ***extra_data = (void ***) PG_GETARG_POINTER(4);
entries = extract_jsp_query(jp, strategy, false, nentries,
extra_data);
@@ -934,7 +934,7 @@ gin_consistent_jsonb(PG_FUNCTION_ARGS)
/* Jsonb *query = PG_GETARG_JSONB_P(2); */
int32 nkeys = PG_GETARG_INT32(3);
- Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
+ void **extra_data = (void **) PG_GETARG_POINTER(4);
bool *recheck = (bool *) PG_GETARG_POINTER(5);
bool res = true;
int32 i;
@@ -1016,7 +1016,7 @@ gin_triconsistent_jsonb(PG_FUNCTION_ARGS)
/* Jsonb *query = PG_GETARG_JSONB_P(2); */
int32 nkeys = PG_GETARG_INT32(3);
- Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
+ void **extra_data = (void **) PG_GETARG_POINTER(4);
GinTernaryValue res = GIN_MAYBE;
int32 i;
@@ -1198,7 +1198,7 @@ gin_extract_jsonb_query_path(PG_FUNCTION_ARGS)
strategy == JsonbJsonpathExistsStrategyNumber)
{
JsonPath *jp = PG_GETARG_JSONPATH_P(0);
- Pointer **extra_data = (Pointer **) PG_GETARG_POINTER(4);
+ void ***extra_data = (void ***) PG_GETARG_POINTER(4);
entries = extract_jsp_query(jp, strategy, true, nentries,
extra_data);
@@ -1222,7 +1222,7 @@ gin_consistent_jsonb_path(PG_FUNCTION_ARGS)
/* Jsonb *query = PG_GETARG_JSONB_P(2); */
int32 nkeys = PG_GETARG_INT32(3);
- Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
+ void **extra_data = (void **) PG_GETARG_POINTER(4);
bool *recheck = (bool *) PG_GETARG_POINTER(5);
bool res = true;
int32 i;
@@ -1273,7 +1273,7 @@ gin_triconsistent_jsonb_path(PG_FUNCTION_ARGS)
/* Jsonb *query = PG_GETARG_JSONB_P(2); */
int32 nkeys = PG_GETARG_INT32(3);
- Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
+ void **extra_data = (void **) PG_GETARG_POINTER(4);
GinTernaryValue res = GIN_MAYBE;
int32 i;
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
index 540aa9628d7..f97d50641cf 100644
--- a/src/backend/utils/adt/selfuncs.c
+++ b/src/backend/utils/adt/selfuncs.c
@@ -8249,7 +8249,7 @@ gincost_pattern(IndexOptInfo *index, int indexcol,
righttype;
int32 nentries = 0;
bool *partial_matches = NULL;
- Pointer *extra_data = NULL;
+ void **extra_data = NULL;
bool *nullFlags = NULL;
int32 searchMode = GIN_SEARCH_MODE_DEFAULT;
int32 i;
diff --git a/src/backend/utils/adt/tsginidx.c b/src/backend/utils/adt/tsginidx.c
index 2712fd89df0..4fe01d5a005 100644
--- a/src/backend/utils/adt/tsginidx.c
+++ b/src/backend/utils/adt/tsginidx.c
@@ -44,7 +44,7 @@ gin_cmp_prefix(PG_FUNCTION_ARGS)
#ifdef NOT_USED
StrategyNumber strategy = PG_GETARG_UINT16(2);
- Pointer extra_data = PG_GETARG_POINTER(3);
+ void *extra_data = (void *) PG_GETARG_POINTER(3);
#endif
int cmp;
@@ -98,7 +98,7 @@ gin_extract_tsquery(PG_FUNCTION_ARGS)
/* StrategyNumber strategy = PG_GETARG_UINT16(2); */
bool **ptr_partialmatch = (bool **) PG_GETARG_POINTER(3);
- Pointer **extra_data = (Pointer **) PG_GETARG_POINTER(4);
+ void ***extra_data = (void ***) PG_GETARG_POINTER(4);
/* bool **nullFlags = (bool **) PG_GETARG_POINTER(5); */
int32 *searchMode = (int32 *) PG_GETARG_POINTER(6);
@@ -141,7 +141,7 @@ gin_extract_tsquery(PG_FUNCTION_ARGS)
* same, entry's) number. Entry's number is used in check array
in
* consistent method. We use the same map for each entry.
*/
- *extra_data = (Pointer *) palloc(sizeof(Pointer) * j);
+ *extra_data = palloc(sizeof(void *) * j);
map_item_operand = (int *) palloc0(sizeof(int) * query->size);
/* Now rescan the VAL items and fill in the arrays */
@@ -157,7 +157,7 @@ gin_extract_tsquery(PG_FUNCTION_ARGS)
val->length);
entries[j] = PointerGetDatum(txt);
partialmatch[j] = val->prefix;
- (*extra_data)[j] = (Pointer) map_item_operand;
+ (*extra_data)[j] = map_item_operand;
map_item_operand[i] = j;
j++;
}
@@ -219,7 +219,7 @@ gin_tsquery_consistent(PG_FUNCTION_ARGS)
TSQuery query = PG_GETARG_TSQUERY(2);
/* int32 nkeys = PG_GETARG_INT32(3); */
- Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
+ void **extra_data = (void **) PG_GETARG_POINTER(4);
bool *recheck = (bool *) PG_GETARG_POINTER(5);
bool res = false;
@@ -236,7 +236,7 @@ gin_tsquery_consistent(PG_FUNCTION_ARGS)
*/
gcv.first_item = GETQUERY(query);
gcv.check = (GinTernaryValue *) check;
- gcv.map_item_operand = (int *) (extra_data[0]);
+ gcv.map_item_operand = extra_data[0];
switch (TS_execute_ternary(GETQUERY(query),
&gcv,
@@ -268,7 +268,7 @@ gin_tsquery_triconsistent(PG_FUNCTION_ARGS)
TSQuery query = PG_GETARG_TSQUERY(2);
/* int32 nkeys = PG_GETARG_INT32(3); */
- Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
+ void **extra_data = (void **) PG_GETARG_POINTER(4);
GinTernaryValue res = GIN_FALSE;
if (query->size > 0)
@@ -281,7 +281,7 @@ gin_tsquery_triconsistent(PG_FUNCTION_ARGS)
*/
gcv.first_item = GETQUERY(query);
gcv.check = check;
- gcv.map_item_operand = (int *) (extra_data[0]);
+ gcv.map_item_operand = extra_data[0];
res = TS_execute_ternary(GETQUERY(query),
&gcv,
diff --git a/src/include/access/gin_private.h b/src/include/access/gin_private.h
index db19ffd9897..ff42c41847c 100644
--- a/src/include/access/gin_private.h
+++ b/src/include/access/gin_private.h
@@ -214,7 +214,7 @@ extern void ginInsertValue(GinBtree btree, GinBtreeStack
*stack,
/* ginentrypage.c */
extern IndexTuple GinFormTuple(GinState *ginstate,
OffsetNumber attnum,
Datum key, GinNullCategory category,
- Pointer data, Size
dataSize, int nipd, bool errorTooBig);
+ void *data, Size
dataSize, int nipd, bool errorTooBig);
extern void ginPrepareEntryScan(GinBtree btree, OffsetNumber attnum,
Datum key,
GinNullCategory category,
GinState
*ginstate);
@@ -303,7 +303,7 @@ typedef struct GinScanKeyData
/* NB: these three arrays have only nuserentries elements! */
Datum *queryValues;
GinNullCategory *queryCategories;
- Pointer *extra_data;
+ void **extra_data;
StrategyNumber strategy;
int32 searchMode;
OffsetNumber attnum;
@@ -341,7 +341,7 @@ typedef struct GinScanEntryData
Datum queryKey;
GinNullCategory queryCategory;
bool isPartialMatch;
- Pointer extra_data;
+ void *extra_data;
StrategyNumber strategy;
int32 searchMode;
OffsetNumber attnum;
diff --git a/src/include/access/ginblock.h b/src/include/access/ginblock.h
index 4c1681068db..e7365c220cf 100644
--- a/src/include/access/ginblock.h
+++ b/src/include/access/ginblock.h
@@ -236,7 +236,7 @@ typedef signed char GinNullCategory;
#define GIN_ITUP_COMPRESSED (1U << 31)
#define GinGetPostingOffset(itup)
(GinItemPointerGetBlockNumber(&(itup)->t_tid) & (~GIN_ITUP_COMPRESSED))
#define GinSetPostingOffset(itup,n)
ItemPointerSetBlockNumber(&(itup)->t_tid,(n)|GIN_ITUP_COMPRESSED)
-#define GinGetPosting(itup) ((Pointer) ((char*)(itup) +
GinGetPostingOffset(itup)))
+#define GinGetPosting(itup) ((void *) ((char*)(itup) +
GinGetPostingOffset(itup)))
#define GinItupIsCompressed(itup)
((GinItemPointerGetBlockNumber(&(itup)->t_tid) & GIN_ITUP_COMPRESSED) != 0)
/*
--
2.52.0