Rename functions to avoid future conflicts
Rename range_serialize/range_deserialize to brin_range_serialize/brin_range_deserialize, since there are already public range_serialize/range_deserialize in rangetypes.h. Author: Paul A. Jungwirth <pj@illuminatedcomputing.com> Discussion: https://www.postgresql.org/message-id/CA+renyX0ipvY6A_jUOHeB1q9mL4bEYfAZ5FBB7G7jUo5bykjrA@mail.gmail.com
This commit is contained in:
parent
376ce3e404
commit
ee41960738
@ -198,7 +198,7 @@ typedef struct Ranges
|
|||||||
* with basic metadata, followed by the boundary values. It has a varlena
|
* with basic metadata, followed by the boundary values. It has a varlena
|
||||||
* header, so can be treated as varlena directly.
|
* header, so can be treated as varlena directly.
|
||||||
*
|
*
|
||||||
* See range_serialize/range_deserialize for serialization details.
|
* See brin_range_serialize/brin_range_deserialize for serialization details.
|
||||||
*/
|
*/
|
||||||
typedef struct SerializedRanges
|
typedef struct SerializedRanges
|
||||||
{
|
{
|
||||||
@ -217,9 +217,9 @@ typedef struct SerializedRanges
|
|||||||
char data[FLEXIBLE_ARRAY_MEMBER];
|
char data[FLEXIBLE_ARRAY_MEMBER];
|
||||||
} SerializedRanges;
|
} SerializedRanges;
|
||||||
|
|
||||||
static SerializedRanges *range_serialize(Ranges *range);
|
static SerializedRanges *brin_range_serialize(Ranges *range);
|
||||||
|
|
||||||
static Ranges *range_deserialize(int maxvalues, SerializedRanges *range);
|
static Ranges *brin_range_deserialize(int maxvalues, SerializedRanges *range);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -566,14 +566,14 @@ range_deduplicate_values(Ranges *range)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* range_serialize
|
* brin_range_serialize
|
||||||
* Serialize the in-memory representation into a compact varlena value.
|
* Serialize the in-memory representation into a compact varlena value.
|
||||||
*
|
*
|
||||||
* Simply copy the header and then also the individual values, as stored
|
* Simply copy the header and then also the individual values, as stored
|
||||||
* in the in-memory value array.
|
* in the in-memory value array.
|
||||||
*/
|
*/
|
||||||
static SerializedRanges *
|
static SerializedRanges *
|
||||||
range_serialize(Ranges *range)
|
brin_range_serialize(Ranges *range)
|
||||||
{
|
{
|
||||||
Size len;
|
Size len;
|
||||||
int nvalues;
|
int nvalues;
|
||||||
@ -712,14 +712,14 @@ range_serialize(Ranges *range)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* range_deserialize
|
* brin_range_deserialize
|
||||||
* Serialize the in-memory representation into a compact varlena value.
|
* Serialize the in-memory representation into a compact varlena value.
|
||||||
*
|
*
|
||||||
* Simply copy the header and then also the individual values, as stored
|
* Simply copy the header and then also the individual values, as stored
|
||||||
* in the in-memory value array.
|
* in the in-memory value array.
|
||||||
*/
|
*/
|
||||||
static Ranges *
|
static Ranges *
|
||||||
range_deserialize(int maxvalues, SerializedRanges *serialized)
|
brin_range_deserialize(int maxvalues, SerializedRanges *serialized)
|
||||||
{
|
{
|
||||||
int i,
|
int i,
|
||||||
nvalues;
|
nvalues;
|
||||||
@ -2405,7 +2405,7 @@ brin_minmax_multi_serialize(BrinDesc *bdesc, Datum src, Datum *dst)
|
|||||||
/* At this point everything has to be fully sorted. */
|
/* At this point everything has to be fully sorted. */
|
||||||
Assert(ranges->nsorted == ranges->nvalues);
|
Assert(ranges->nsorted == ranges->nvalues);
|
||||||
|
|
||||||
s = range_serialize(ranges);
|
s = brin_range_serialize(ranges);
|
||||||
dst[0] = PointerGetDatum(s);
|
dst[0] = PointerGetDatum(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2528,7 +2528,7 @@ brin_minmax_multi_add_value(PG_FUNCTION_ARGS)
|
|||||||
maxvalues = Max(maxvalues, MINMAX_BUFFER_MIN);
|
maxvalues = Max(maxvalues, MINMAX_BUFFER_MIN);
|
||||||
maxvalues = Min(maxvalues, MINMAX_BUFFER_MAX);
|
maxvalues = Min(maxvalues, MINMAX_BUFFER_MAX);
|
||||||
|
|
||||||
ranges = range_deserialize(maxvalues, serialized);
|
ranges = brin_range_deserialize(maxvalues, serialized);
|
||||||
|
|
||||||
ranges->attno = attno;
|
ranges->attno = attno;
|
||||||
ranges->colloid = colloid;
|
ranges->colloid = colloid;
|
||||||
@ -2581,7 +2581,7 @@ brin_minmax_multi_consistent(PG_FUNCTION_ARGS)
|
|||||||
attno = column->bv_attno;
|
attno = column->bv_attno;
|
||||||
|
|
||||||
serialized = (SerializedRanges *) PG_DETOAST_DATUM(column->bv_values[0]);
|
serialized = (SerializedRanges *) PG_DETOAST_DATUM(column->bv_values[0]);
|
||||||
ranges = range_deserialize(serialized->maxvalues, serialized);
|
ranges = brin_range_deserialize(serialized->maxvalues, serialized);
|
||||||
|
|
||||||
/* inspect the ranges, and for each one evaluate the scan keys */
|
/* inspect the ranges, and for each one evaluate the scan keys */
|
||||||
for (rangeno = 0; rangeno < ranges->nranges; rangeno++)
|
for (rangeno = 0; rangeno < ranges->nranges; rangeno++)
|
||||||
@ -2776,8 +2776,8 @@ brin_minmax_multi_union(PG_FUNCTION_ARGS)
|
|||||||
serialized_a = (SerializedRanges *) PG_DETOAST_DATUM(col_a->bv_values[0]);
|
serialized_a = (SerializedRanges *) PG_DETOAST_DATUM(col_a->bv_values[0]);
|
||||||
serialized_b = (SerializedRanges *) PG_DETOAST_DATUM(col_b->bv_values[0]);
|
serialized_b = (SerializedRanges *) PG_DETOAST_DATUM(col_b->bv_values[0]);
|
||||||
|
|
||||||
ranges_a = range_deserialize(serialized_a->maxvalues, serialized_a);
|
ranges_a = brin_range_deserialize(serialized_a->maxvalues, serialized_a);
|
||||||
ranges_b = range_deserialize(serialized_b->maxvalues, serialized_b);
|
ranges_b = brin_range_deserialize(serialized_b->maxvalues, serialized_b);
|
||||||
|
|
||||||
/* make sure neither of the ranges is NULL */
|
/* make sure neither of the ranges is NULL */
|
||||||
Assert(ranges_a && ranges_b);
|
Assert(ranges_a && ranges_b);
|
||||||
@ -2859,7 +2859,7 @@ brin_minmax_multi_union(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
/* cleanup and update the serialized value */
|
/* cleanup and update the serialized value */
|
||||||
pfree(serialized_a);
|
pfree(serialized_a);
|
||||||
col_a->bv_values[0] = PointerGetDatum(range_serialize(ranges_a));
|
col_a->bv_values[0] = PointerGetDatum(brin_range_serialize(ranges_a));
|
||||||
|
|
||||||
PG_RETURN_VOID();
|
PG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
@ -3041,7 +3041,7 @@ brin_minmax_multi_summary_out(PG_FUNCTION_ARGS)
|
|||||||
fmgr_info(outfunc, &fmgrinfo);
|
fmgr_info(outfunc, &fmgrinfo);
|
||||||
|
|
||||||
/* deserialize the range info easy-to-process pieces */
|
/* deserialize the range info easy-to-process pieces */
|
||||||
ranges_deserialized = range_deserialize(ranges->maxvalues, ranges);
|
ranges_deserialized = brin_range_deserialize(ranges->maxvalues, ranges);
|
||||||
|
|
||||||
appendStringInfo(&str, "nranges: %d nvalues: %d maxvalues: %d",
|
appendStringInfo(&str, "nranges: %d nvalues: %d maxvalues: %d",
|
||||||
ranges_deserialized->nranges,
|
ranges_deserialized->nranges,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user