mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Add const qualifiers to internal range type APIs
Reviewed-by: Andres Freund <andres@anarazel.de> Discussion: https://www.postgresql.org/message-id/flat/dc9b45fa-b950-fadc-4751-85d6f729df55%402ndquadrant.com
This commit is contained in:
@ -554,7 +554,7 @@ elem_contained_by_range(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
/* equality (internal version) */
|
/* equality (internal version) */
|
||||||
bool
|
bool
|
||||||
range_eq_internal(TypeCacheEntry *typcache, RangeType *r1, RangeType *r2)
|
range_eq_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
|
||||||
{
|
{
|
||||||
RangeBound lower1,
|
RangeBound lower1,
|
||||||
lower2;
|
lower2;
|
||||||
@ -599,7 +599,7 @@ range_eq(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
/* inequality (internal version) */
|
/* inequality (internal version) */
|
||||||
bool
|
bool
|
||||||
range_ne_internal(TypeCacheEntry *typcache, RangeType *r1, RangeType *r2)
|
range_ne_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
|
||||||
{
|
{
|
||||||
return (!range_eq_internal(typcache, r1, r2));
|
return (!range_eq_internal(typcache, r1, r2));
|
||||||
}
|
}
|
||||||
@ -645,7 +645,7 @@ range_contained_by(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
/* strictly left of? (internal version) */
|
/* strictly left of? (internal version) */
|
||||||
bool
|
bool
|
||||||
range_before_internal(TypeCacheEntry *typcache, RangeType *r1, RangeType *r2)
|
range_before_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
|
||||||
{
|
{
|
||||||
RangeBound lower1,
|
RangeBound lower1,
|
||||||
lower2;
|
lower2;
|
||||||
@ -683,7 +683,7 @@ range_before(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
/* strictly right of? (internal version) */
|
/* strictly right of? (internal version) */
|
||||||
bool
|
bool
|
||||||
range_after_internal(TypeCacheEntry *typcache, RangeType *r1, RangeType *r2)
|
range_after_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
|
||||||
{
|
{
|
||||||
RangeBound lower1,
|
RangeBound lower1,
|
||||||
lower2;
|
lower2;
|
||||||
@ -779,7 +779,7 @@ bounds_adjacent(TypeCacheEntry *typcache, RangeBound boundA, RangeBound boundB)
|
|||||||
|
|
||||||
/* adjacent to (but not overlapping)? (internal version) */
|
/* adjacent to (but not overlapping)? (internal version) */
|
||||||
bool
|
bool
|
||||||
range_adjacent_internal(TypeCacheEntry *typcache, RangeType *r1, RangeType *r2)
|
range_adjacent_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
|
||||||
{
|
{
|
||||||
RangeBound lower1,
|
RangeBound lower1,
|
||||||
lower2;
|
lower2;
|
||||||
@ -822,7 +822,7 @@ range_adjacent(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
/* overlaps? (internal version) */
|
/* overlaps? (internal version) */
|
||||||
bool
|
bool
|
||||||
range_overlaps_internal(TypeCacheEntry *typcache, RangeType *r1, RangeType *r2)
|
range_overlaps_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
|
||||||
{
|
{
|
||||||
RangeBound lower1,
|
RangeBound lower1,
|
||||||
lower2;
|
lower2;
|
||||||
@ -868,7 +868,7 @@ range_overlaps(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
/* does not extend to right of? (internal version) */
|
/* does not extend to right of? (internal version) */
|
||||||
bool
|
bool
|
||||||
range_overleft_internal(TypeCacheEntry *typcache, RangeType *r1, RangeType *r2)
|
range_overleft_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
|
||||||
{
|
{
|
||||||
RangeBound lower1,
|
RangeBound lower1,
|
||||||
lower2;
|
lower2;
|
||||||
@ -909,7 +909,7 @@ range_overleft(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
/* does not extend to left of? (internal version) */
|
/* does not extend to left of? (internal version) */
|
||||||
bool
|
bool
|
||||||
range_overright_internal(TypeCacheEntry *typcache, RangeType *r1, RangeType *r2)
|
range_overright_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
|
||||||
{
|
{
|
||||||
RangeBound lower1,
|
RangeBound lower1,
|
||||||
lower2;
|
lower2;
|
||||||
@ -1696,7 +1696,7 @@ range_serialize(TypeCacheEntry *typcache, RangeBound *lower, RangeBound *upper,
|
|||||||
* RangeBound structs will be pointers into the given range object.
|
* RangeBound structs will be pointers into the given range object.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
range_deserialize(TypeCacheEntry *typcache, RangeType *range,
|
range_deserialize(TypeCacheEntry *typcache, const RangeType *range,
|
||||||
RangeBound *lower, RangeBound *upper, bool *empty)
|
RangeBound *lower, RangeBound *upper, bool *empty)
|
||||||
{
|
{
|
||||||
char flags;
|
char flags;
|
||||||
@ -1711,7 +1711,7 @@ range_deserialize(TypeCacheEntry *typcache, RangeType *range,
|
|||||||
Assert(RangeTypeGetOid(range) == typcache->type_id);
|
Assert(RangeTypeGetOid(range) == typcache->type_id);
|
||||||
|
|
||||||
/* fetch the flag byte from datum's last byte */
|
/* fetch the flag byte from datum's last byte */
|
||||||
flags = *((char *) range + VARSIZE(range) - 1);
|
flags = *((const char *) range + VARSIZE(range) - 1);
|
||||||
|
|
||||||
/* fetch information about range's element type */
|
/* fetch information about range's element type */
|
||||||
typlen = typcache->rngelemtype->typlen;
|
typlen = typcache->rngelemtype->typlen;
|
||||||
@ -1763,7 +1763,7 @@ range_deserialize(TypeCacheEntry *typcache, RangeType *range,
|
|||||||
* the full results of range_deserialize.
|
* the full results of range_deserialize.
|
||||||
*/
|
*/
|
||||||
char
|
char
|
||||||
range_get_flags(RangeType *range)
|
range_get_flags(const RangeType *range)
|
||||||
{
|
{
|
||||||
/* fetch the flag byte from datum's last byte */
|
/* fetch the flag byte from datum's last byte */
|
||||||
return *((char *) range + VARSIZE(range) - 1);
|
return *((char *) range + VARSIZE(range) - 1);
|
||||||
@ -1832,7 +1832,7 @@ make_range(TypeCacheEntry *typcache, RangeBound *lower, RangeBound *upper,
|
|||||||
* but one is an upper bound and the other a lower bound.
|
* but one is an upper bound and the other a lower bound.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
range_cmp_bounds(TypeCacheEntry *typcache, RangeBound *b1, RangeBound *b2)
|
range_cmp_bounds(TypeCacheEntry *typcache, const RangeBound *b1, const RangeBound *b2)
|
||||||
{
|
{
|
||||||
int32 result;
|
int32 result;
|
||||||
|
|
||||||
@ -1906,8 +1906,8 @@ range_cmp_bounds(TypeCacheEntry *typcache, RangeBound *b1, RangeBound *b2)
|
|||||||
* infinity is plus or minus.
|
* infinity is plus or minus.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
range_cmp_bound_values(TypeCacheEntry *typcache, RangeBound *b1,
|
range_cmp_bound_values(TypeCacheEntry *typcache, const RangeBound *b1,
|
||||||
RangeBound *b2)
|
const RangeBound *b2)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* First, handle cases involving infinity, which don't require invoking
|
* First, handle cases involving infinity, which don't require invoking
|
||||||
@ -2300,7 +2300,7 @@ range_bound_escape(const char *value)
|
|||||||
* the necessary typcache entry.
|
* the necessary typcache entry.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
range_contains_internal(TypeCacheEntry *typcache, RangeType *r1, RangeType *r2)
|
range_contains_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
|
||||||
{
|
{
|
||||||
RangeBound lower1;
|
RangeBound lower1;
|
||||||
RangeBound upper1;
|
RangeBound upper1;
|
||||||
@ -2332,7 +2332,7 @@ range_contains_internal(TypeCacheEntry *typcache, RangeType *r1, RangeType *r2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
range_contained_by_internal(TypeCacheEntry *typcache, RangeType *r1, RangeType *r2)
|
range_contained_by_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
|
||||||
{
|
{
|
||||||
return range_contains_internal(typcache, r2, r1);
|
return range_contains_internal(typcache, r2, r1);
|
||||||
}
|
}
|
||||||
@ -2341,7 +2341,7 @@ range_contained_by_internal(TypeCacheEntry *typcache, RangeType *r1, RangeType *
|
|||||||
* Test whether range r contains a specific element value.
|
* Test whether range r contains a specific element value.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
range_contains_elem_internal(TypeCacheEntry *typcache, RangeType *r, Datum val)
|
range_contains_elem_internal(TypeCacheEntry *typcache, const RangeType *r, Datum val)
|
||||||
{
|
{
|
||||||
RangeBound lower;
|
RangeBound lower;
|
||||||
RangeBound upper;
|
RangeBound upper;
|
||||||
|
@ -137,10 +137,10 @@ typedef struct
|
|||||||
static RangeType *range_super_union(TypeCacheEntry *typcache, RangeType *r1,
|
static RangeType *range_super_union(TypeCacheEntry *typcache, RangeType *r1,
|
||||||
RangeType *r2);
|
RangeType *r2);
|
||||||
static bool range_gist_consistent_int(TypeCacheEntry *typcache,
|
static bool range_gist_consistent_int(TypeCacheEntry *typcache,
|
||||||
StrategyNumber strategy, RangeType *key,
|
StrategyNumber strategy, const RangeType *key,
|
||||||
Datum query);
|
Datum query);
|
||||||
static bool range_gist_consistent_leaf(TypeCacheEntry *typcache,
|
static bool range_gist_consistent_leaf(TypeCacheEntry *typcache,
|
||||||
StrategyNumber strategy, RangeType *key,
|
StrategyNumber strategy, const RangeType *key,
|
||||||
Datum query);
|
Datum query);
|
||||||
static void range_gist_fallback_split(TypeCacheEntry *typcache,
|
static void range_gist_fallback_split(TypeCacheEntry *typcache,
|
||||||
GistEntryVector *entryvec,
|
GistEntryVector *entryvec,
|
||||||
@ -764,7 +764,7 @@ range_super_union(TypeCacheEntry *typcache, RangeType *r1, RangeType *r2)
|
|||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
range_gist_consistent_int(TypeCacheEntry *typcache, StrategyNumber strategy,
|
range_gist_consistent_int(TypeCacheEntry *typcache, StrategyNumber strategy,
|
||||||
RangeType *key, Datum query)
|
const RangeType *key, Datum query)
|
||||||
{
|
{
|
||||||
switch (strategy)
|
switch (strategy)
|
||||||
{
|
{
|
||||||
@ -836,7 +836,7 @@ range_gist_consistent_int(TypeCacheEntry *typcache, StrategyNumber strategy,
|
|||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
range_gist_consistent_leaf(TypeCacheEntry *typcache, StrategyNumber strategy,
|
range_gist_consistent_leaf(TypeCacheEntry *typcache, StrategyNumber strategy,
|
||||||
RangeType *key, Datum query)
|
const RangeType *key, Datum query)
|
||||||
{
|
{
|
||||||
switch (strategy)
|
switch (strategy)
|
||||||
{
|
{
|
||||||
|
@ -31,33 +31,33 @@
|
|||||||
#include "utils/typcache.h"
|
#include "utils/typcache.h"
|
||||||
|
|
||||||
static double calc_rangesel(TypeCacheEntry *typcache, VariableStatData *vardata,
|
static double calc_rangesel(TypeCacheEntry *typcache, VariableStatData *vardata,
|
||||||
RangeType *constval, Oid operator);
|
const RangeType *constval, Oid operator);
|
||||||
static double default_range_selectivity(Oid operator);
|
static double default_range_selectivity(Oid operator);
|
||||||
static double calc_hist_selectivity(TypeCacheEntry *typcache,
|
static double calc_hist_selectivity(TypeCacheEntry *typcache,
|
||||||
VariableStatData *vardata, RangeType *constval,
|
VariableStatData *vardata, const RangeType *constval,
|
||||||
Oid operator);
|
Oid operator);
|
||||||
static double calc_hist_selectivity_scalar(TypeCacheEntry *typcache,
|
static double calc_hist_selectivity_scalar(TypeCacheEntry *typcache,
|
||||||
RangeBound *constbound,
|
const RangeBound *constbound,
|
||||||
RangeBound *hist, int hist_nvalues,
|
const RangeBound *hist, int hist_nvalues,
|
||||||
bool equal);
|
bool equal);
|
||||||
static int rbound_bsearch(TypeCacheEntry *typcache, RangeBound *value,
|
static int rbound_bsearch(TypeCacheEntry *typcache, const RangeBound *value,
|
||||||
RangeBound *hist, int hist_length, bool equal);
|
const RangeBound *hist, int hist_length, bool equal);
|
||||||
static float8 get_position(TypeCacheEntry *typcache, RangeBound *value,
|
static float8 get_position(TypeCacheEntry *typcache, const RangeBound *value,
|
||||||
RangeBound *hist1, RangeBound *hist2);
|
const RangeBound *hist1, const RangeBound *hist2);
|
||||||
static float8 get_len_position(double value, double hist1, double hist2);
|
static float8 get_len_position(double value, double hist1, double hist2);
|
||||||
static float8 get_distance(TypeCacheEntry *typcache, RangeBound *bound1,
|
static float8 get_distance(TypeCacheEntry *typcache, const RangeBound *bound1,
|
||||||
RangeBound *bound2);
|
const RangeBound *bound2);
|
||||||
static int length_hist_bsearch(Datum *length_hist_values,
|
static int length_hist_bsearch(Datum *length_hist_values,
|
||||||
int length_hist_nvalues, double value, bool equal);
|
int length_hist_nvalues, double value, bool equal);
|
||||||
static double calc_length_hist_frac(Datum *length_hist_values,
|
static double calc_length_hist_frac(Datum *length_hist_values,
|
||||||
int length_hist_nvalues, double length1, double length2, bool equal);
|
int length_hist_nvalues, double length1, double length2, bool equal);
|
||||||
static double calc_hist_selectivity_contained(TypeCacheEntry *typcache,
|
static double calc_hist_selectivity_contained(TypeCacheEntry *typcache,
|
||||||
RangeBound *lower, RangeBound *upper,
|
const RangeBound *lower, RangeBound *upper,
|
||||||
RangeBound *hist_lower, int hist_nvalues,
|
const RangeBound *hist_lower, int hist_nvalues,
|
||||||
Datum *length_hist_values, int length_hist_nvalues);
|
Datum *length_hist_values, int length_hist_nvalues);
|
||||||
static double calc_hist_selectivity_contains(TypeCacheEntry *typcache,
|
static double calc_hist_selectivity_contains(TypeCacheEntry *typcache,
|
||||||
RangeBound *lower, RangeBound *upper,
|
const RangeBound *lower, const RangeBound *upper,
|
||||||
RangeBound *hist_lower, int hist_nvalues,
|
const RangeBound *hist_lower, int hist_nvalues,
|
||||||
Datum *length_hist_values, int length_hist_nvalues);
|
Datum *length_hist_values, int length_hist_nvalues);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -229,7 +229,7 @@ rangesel(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
static double
|
static double
|
||||||
calc_rangesel(TypeCacheEntry *typcache, VariableStatData *vardata,
|
calc_rangesel(TypeCacheEntry *typcache, VariableStatData *vardata,
|
||||||
RangeType *constval, Oid operator)
|
const RangeType *constval, Oid operator)
|
||||||
{
|
{
|
||||||
double hist_selec;
|
double hist_selec;
|
||||||
double selec;
|
double selec;
|
||||||
@ -371,7 +371,7 @@ calc_rangesel(TypeCacheEntry *typcache, VariableStatData *vardata,
|
|||||||
*/
|
*/
|
||||||
static double
|
static double
|
||||||
calc_hist_selectivity(TypeCacheEntry *typcache, VariableStatData *vardata,
|
calc_hist_selectivity(TypeCacheEntry *typcache, VariableStatData *vardata,
|
||||||
RangeType *constval, Oid operator)
|
const RangeType *constval, Oid operator)
|
||||||
{
|
{
|
||||||
AttStatsSlot hslot;
|
AttStatsSlot hslot;
|
||||||
AttStatsSlot lslot;
|
AttStatsSlot lslot;
|
||||||
@ -586,8 +586,8 @@ calc_hist_selectivity(TypeCacheEntry *typcache, VariableStatData *vardata,
|
|||||||
* is true) a given const in a histogram of range bounds.
|
* is true) a given const in a histogram of range bounds.
|
||||||
*/
|
*/
|
||||||
static double
|
static double
|
||||||
calc_hist_selectivity_scalar(TypeCacheEntry *typcache, RangeBound *constbound,
|
calc_hist_selectivity_scalar(TypeCacheEntry *typcache, const RangeBound *constbound,
|
||||||
RangeBound *hist, int hist_nvalues, bool equal)
|
const RangeBound *hist, int hist_nvalues, bool equal)
|
||||||
{
|
{
|
||||||
Selectivity selec;
|
Selectivity selec;
|
||||||
int index;
|
int index;
|
||||||
@ -618,7 +618,7 @@ calc_hist_selectivity_scalar(TypeCacheEntry *typcache, RangeBound *constbound,
|
|||||||
* interpolation of portion of bounds which are less or equal to given bound.
|
* interpolation of portion of bounds which are less or equal to given bound.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
rbound_bsearch(TypeCacheEntry *typcache, RangeBound *value, RangeBound *hist,
|
rbound_bsearch(TypeCacheEntry *typcache, const RangeBound *value, const RangeBound *hist,
|
||||||
int hist_length, bool equal)
|
int hist_length, bool equal)
|
||||||
{
|
{
|
||||||
int lower = -1,
|
int lower = -1,
|
||||||
@ -673,8 +673,8 @@ length_hist_bsearch(Datum *length_hist_values, int length_hist_nvalues,
|
|||||||
* Get relative position of value in histogram bin in [0,1] range.
|
* Get relative position of value in histogram bin in [0,1] range.
|
||||||
*/
|
*/
|
||||||
static float8
|
static float8
|
||||||
get_position(TypeCacheEntry *typcache, RangeBound *value, RangeBound *hist1,
|
get_position(TypeCacheEntry *typcache, const RangeBound *value, const RangeBound *hist1,
|
||||||
RangeBound *hist2)
|
const RangeBound *hist2)
|
||||||
{
|
{
|
||||||
bool has_subdiff = OidIsValid(typcache->rng_subdiff_finfo.fn_oid);
|
bool has_subdiff = OidIsValid(typcache->rng_subdiff_finfo.fn_oid);
|
||||||
float8 position;
|
float8 position;
|
||||||
@ -795,7 +795,7 @@ get_len_position(double value, double hist1, double hist2)
|
|||||||
* Measure distance between two range bounds.
|
* Measure distance between two range bounds.
|
||||||
*/
|
*/
|
||||||
static float8
|
static float8
|
||||||
get_distance(TypeCacheEntry *typcache, RangeBound *bound1, RangeBound *bound2)
|
get_distance(TypeCacheEntry *typcache, const RangeBound *bound1, const RangeBound *bound2)
|
||||||
{
|
{
|
||||||
bool has_subdiff = OidIsValid(typcache->rng_subdiff_finfo.fn_oid);
|
bool has_subdiff = OidIsValid(typcache->rng_subdiff_finfo.fn_oid);
|
||||||
|
|
||||||
@ -999,8 +999,8 @@ calc_length_hist_frac(Datum *length_hist_values, int length_hist_nvalues,
|
|||||||
*/
|
*/
|
||||||
static double
|
static double
|
||||||
calc_hist_selectivity_contained(TypeCacheEntry *typcache,
|
calc_hist_selectivity_contained(TypeCacheEntry *typcache,
|
||||||
RangeBound *lower, RangeBound *upper,
|
const RangeBound *lower, RangeBound *upper,
|
||||||
RangeBound *hist_lower, int hist_nvalues,
|
const RangeBound *hist_lower, int hist_nvalues,
|
||||||
Datum *length_hist_values, int length_hist_nvalues)
|
Datum *length_hist_values, int length_hist_nvalues)
|
||||||
{
|
{
|
||||||
int i,
|
int i,
|
||||||
@ -1109,8 +1109,8 @@ calc_hist_selectivity_contained(TypeCacheEntry *typcache,
|
|||||||
*/
|
*/
|
||||||
static double
|
static double
|
||||||
calc_hist_selectivity_contains(TypeCacheEntry *typcache,
|
calc_hist_selectivity_contains(TypeCacheEntry *typcache,
|
||||||
RangeBound *lower, RangeBound *upper,
|
const RangeBound *lower, const RangeBound *upper,
|
||||||
RangeBound *hist_lower, int hist_nvalues,
|
const RangeBound *hist_lower, int hist_nvalues,
|
||||||
Datum *length_hist_values, int length_hist_nvalues)
|
Datum *length_hist_values, int length_hist_nvalues)
|
||||||
{
|
{
|
||||||
int i,
|
int i,
|
||||||
|
@ -43,15 +43,15 @@
|
|||||||
#include "utils/datum.h"
|
#include "utils/datum.h"
|
||||||
#include "utils/rangetypes.h"
|
#include "utils/rangetypes.h"
|
||||||
|
|
||||||
static int16 getQuadrant(TypeCacheEntry *typcache, RangeType *centroid,
|
static int16 getQuadrant(TypeCacheEntry *typcache, const RangeType *centroid,
|
||||||
RangeType *tst);
|
const RangeType *tst);
|
||||||
static int bound_cmp(const void *a, const void *b, void *arg);
|
static int bound_cmp(const void *a, const void *b, void *arg);
|
||||||
|
|
||||||
static int adjacent_inner_consistent(TypeCacheEntry *typcache,
|
static int adjacent_inner_consistent(TypeCacheEntry *typcache,
|
||||||
RangeBound *arg, RangeBound *centroid,
|
const RangeBound *arg, const RangeBound *centroid,
|
||||||
RangeBound *prev);
|
const RangeBound *prev);
|
||||||
static int adjacent_cmp_bounds(TypeCacheEntry *typcache, RangeBound *arg,
|
static int adjacent_cmp_bounds(TypeCacheEntry *typcache, const RangeBound *arg,
|
||||||
RangeBound *centroid);
|
const RangeBound *centroid);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SP-GiST 'config' interface function.
|
* SP-GiST 'config' interface function.
|
||||||
@ -92,7 +92,7 @@ spg_range_quad_config(PG_FUNCTION_ARGS)
|
|||||||
*----------
|
*----------
|
||||||
*/
|
*/
|
||||||
static int16
|
static int16
|
||||||
getQuadrant(TypeCacheEntry *typcache, RangeType *centroid, RangeType *tst)
|
getQuadrant(TypeCacheEntry *typcache, const RangeType *centroid, const RangeType *tst)
|
||||||
{
|
{
|
||||||
RangeBound centroidLower,
|
RangeBound centroidLower,
|
||||||
centroidUpper;
|
centroidUpper;
|
||||||
@ -785,8 +785,8 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS)
|
|||||||
* For the "left" case, returns -1, and for the "right" case, returns 1.
|
* For the "left" case, returns -1, and for the "right" case, returns 1.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
adjacent_cmp_bounds(TypeCacheEntry *typcache, RangeBound *arg,
|
adjacent_cmp_bounds(TypeCacheEntry *typcache, const RangeBound *arg,
|
||||||
RangeBound *centroid)
|
const RangeBound *centroid)
|
||||||
{
|
{
|
||||||
int cmp;
|
int cmp;
|
||||||
|
|
||||||
@ -887,8 +887,8 @@ adjacent_cmp_bounds(TypeCacheEntry *typcache, RangeBound *arg,
|
|||||||
*----------
|
*----------
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
adjacent_inner_consistent(TypeCacheEntry *typcache, RangeBound *arg,
|
adjacent_inner_consistent(TypeCacheEntry *typcache, const RangeBound *arg,
|
||||||
RangeBound *centroid, RangeBound *prev)
|
const RangeBound *centroid, const RangeBound *prev)
|
||||||
{
|
{
|
||||||
if (prev)
|
if (prev)
|
||||||
{
|
{
|
||||||
|
@ -92,46 +92,46 @@ typedef struct
|
|||||||
* prototypes for functions defined in rangetypes.c
|
* prototypes for functions defined in rangetypes.c
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern bool range_contains_elem_internal(TypeCacheEntry *typcache, RangeType *r, Datum val);
|
extern bool range_contains_elem_internal(TypeCacheEntry *typcache, const RangeType *r, Datum val);
|
||||||
|
|
||||||
/* internal versions of the above */
|
/* internal versions of the above */
|
||||||
extern bool range_eq_internal(TypeCacheEntry *typcache, RangeType *r1,
|
extern bool range_eq_internal(TypeCacheEntry *typcache, const RangeType *r1,
|
||||||
RangeType *r2);
|
const RangeType *r2);
|
||||||
extern bool range_ne_internal(TypeCacheEntry *typcache, RangeType *r1,
|
extern bool range_ne_internal(TypeCacheEntry *typcache, const RangeType *r1,
|
||||||
RangeType *r2);
|
const RangeType *r2);
|
||||||
extern bool range_contains_internal(TypeCacheEntry *typcache, RangeType *r1,
|
extern bool range_contains_internal(TypeCacheEntry *typcache, const RangeType *r1,
|
||||||
RangeType *r2);
|
const RangeType *r2);
|
||||||
extern bool range_contained_by_internal(TypeCacheEntry *typcache, RangeType *r1,
|
extern bool range_contained_by_internal(TypeCacheEntry *typcache, const RangeType *r1,
|
||||||
RangeType *r2);
|
const RangeType *r2);
|
||||||
extern bool range_before_internal(TypeCacheEntry *typcache, RangeType *r1,
|
extern bool range_before_internal(TypeCacheEntry *typcache, const RangeType *r1,
|
||||||
RangeType *r2);
|
const RangeType *r2);
|
||||||
extern bool range_after_internal(TypeCacheEntry *typcache, RangeType *r1,
|
extern bool range_after_internal(TypeCacheEntry *typcache, const RangeType *r1,
|
||||||
RangeType *r2);
|
const RangeType *r2);
|
||||||
extern bool range_adjacent_internal(TypeCacheEntry *typcache, RangeType *r1,
|
extern bool range_adjacent_internal(TypeCacheEntry *typcache, const RangeType *r1,
|
||||||
RangeType *r2);
|
const RangeType *r2);
|
||||||
extern bool range_overlaps_internal(TypeCacheEntry *typcache, RangeType *r1,
|
extern bool range_overlaps_internal(TypeCacheEntry *typcache, const RangeType *r1,
|
||||||
RangeType *r2);
|
const RangeType *r2);
|
||||||
extern bool range_overleft_internal(TypeCacheEntry *typcache, RangeType *r1,
|
extern bool range_overleft_internal(TypeCacheEntry *typcache, const RangeType *r1,
|
||||||
RangeType *r2);
|
const RangeType *r2);
|
||||||
extern bool range_overright_internal(TypeCacheEntry *typcache, RangeType *r1,
|
extern bool range_overright_internal(TypeCacheEntry *typcache, const RangeType *r1,
|
||||||
RangeType *r2);
|
const RangeType *r2);
|
||||||
|
|
||||||
/* assorted support functions */
|
/* assorted support functions */
|
||||||
extern TypeCacheEntry *range_get_typcache(FunctionCallInfo fcinfo,
|
extern TypeCacheEntry *range_get_typcache(FunctionCallInfo fcinfo,
|
||||||
Oid rngtypid);
|
Oid rngtypid);
|
||||||
extern RangeType *range_serialize(TypeCacheEntry *typcache, RangeBound *lower,
|
extern RangeType *range_serialize(TypeCacheEntry *typcache, RangeBound *lower,
|
||||||
RangeBound *upper, bool empty);
|
RangeBound *upper, bool empty);
|
||||||
extern void range_deserialize(TypeCacheEntry *typcache, RangeType *range,
|
extern void range_deserialize(TypeCacheEntry *typcache, const RangeType *range,
|
||||||
RangeBound *lower, RangeBound *upper,
|
RangeBound *lower, RangeBound *upper,
|
||||||
bool *empty);
|
bool *empty);
|
||||||
extern char range_get_flags(RangeType *range);
|
extern char range_get_flags(const RangeType *range);
|
||||||
extern void range_set_contain_empty(RangeType *range);
|
extern void range_set_contain_empty(RangeType *range);
|
||||||
extern RangeType *make_range(TypeCacheEntry *typcache, RangeBound *lower,
|
extern RangeType *make_range(TypeCacheEntry *typcache, RangeBound *lower,
|
||||||
RangeBound *upper, bool empty);
|
RangeBound *upper, bool empty);
|
||||||
extern int range_cmp_bounds(TypeCacheEntry *typcache, RangeBound *b1,
|
extern int range_cmp_bounds(TypeCacheEntry *typcache, const RangeBound *b1,
|
||||||
RangeBound *b2);
|
const RangeBound *b2);
|
||||||
extern int range_cmp_bound_values(TypeCacheEntry *typcache, RangeBound *b1,
|
extern int range_cmp_bound_values(TypeCacheEntry *typcache, const RangeBound *b1,
|
||||||
RangeBound *b2);
|
const RangeBound *b2);
|
||||||
extern bool bounds_adjacent(TypeCacheEntry *typcache, RangeBound bound1,
|
extern bool bounds_adjacent(TypeCacheEntry *typcache, RangeBound bound1,
|
||||||
RangeBound bound2);
|
RangeBound bound2);
|
||||||
extern RangeType *make_empty_range(TypeCacheEntry *typcache);
|
extern RangeType *make_empty_range(TypeCacheEntry *typcache);
|
||||||
|
Reference in New Issue
Block a user