PostgreSQL Source Code
git master
|
#include "utils/typcache.h"
Go to the source code of this file.
Data Structures | |
struct | RangeType |
struct | RangeBound |
#define PG_GETARG_RANGE_P | ( | n | ) | DatumGetRangeTypeP(PG_GETARG_DATUM(n)) |
Definition at line 90 of file rangetypes.h.
#define PG_GETARG_RANGE_P_COPY | ( | n | ) | DatumGetRangeTypePCopy(PG_GETARG_DATUM(n)) |
Definition at line 91 of file rangetypes.h.
#define PG_RETURN_RANGE_P | ( | x | ) | return RangeTypePGetDatum(x) |
Definition at line 92 of file rangetypes.h.
#define RANGE_CONTAIN_EMPTY |
Definition at line 45 of file rangetypes.h.
#define RANGE_EMPTY 0x01 /* range is empty */ |
Definition at line 38 of file rangetypes.h.
#define RANGE_EMPTY_LITERAL "empty" |
Definition at line 32 of file rangetypes.h.
#define RANGE_HAS_LBOUND | ( | flags | ) |
Definition at line 47 of file rangetypes.h.
#define RANGE_HAS_UBOUND | ( | flags | ) |
Definition at line 51 of file rangetypes.h.
#define RANGE_LB_INC 0x02 /* lower bound is inclusive */ |
Definition at line 39 of file rangetypes.h.
#define RANGE_LB_INF 0x08 /* lower bound is -infinity */ |
Definition at line 41 of file rangetypes.h.
#define RANGE_LB_NULL 0x20 /* lower bound is null (NOT USED) */ |
Definition at line 43 of file rangetypes.h.
#define RANGE_UB_INC 0x04 /* upper bound is inclusive */ |
Definition at line 40 of file rangetypes.h.
#define RANGE_UB_INF 0x10 /* upper bound is +infinity */ |
Definition at line 42 of file rangetypes.h.
#define RANGE_UB_NULL 0x40 /* upper bound is null (NOT USED) */ |
Definition at line 44 of file rangetypes.h.
#define RangeIsEmpty | ( | r | ) | ((range_get_flags(r) & RANGE_EMPTY) != 0) |
Definition at line 55 of file rangetypes.h.
#define RangeIsOrContainsEmpty | ( | r | ) | ((range_get_flags(r) & (RANGE_EMPTY | RANGE_CONTAIN_EMPTY)) != 0) |
Definition at line 56 of file rangetypes.h.
#define RANGESTRAT_ADJACENT RTSameStrategyNumber |
Definition at line 101 of file rangetypes.h.
#define RANGESTRAT_AFTER RTRightStrategyNumber |
Definition at line 100 of file rangetypes.h.
#define RANGESTRAT_BEFORE RTLeftStrategyNumber |
Definition at line 96 of file rangetypes.h.
#define RANGESTRAT_CONTAINED_BY RTContainedByStrategyNumber |
Definition at line 103 of file rangetypes.h.
#define RANGESTRAT_CONTAINS RTContainsStrategyNumber |
Definition at line 102 of file rangetypes.h.
#define RANGESTRAT_CONTAINS_ELEM RTContainsElemStrategyNumber |
Definition at line 104 of file rangetypes.h.
#define RANGESTRAT_EQ RTEqualStrategyNumber |
Definition at line 105 of file rangetypes.h.
#define RANGESTRAT_OVERLAPS RTOverlapStrategyNumber |
Definition at line 98 of file rangetypes.h.
#define RANGESTRAT_OVERLEFT RTOverLeftStrategyNumber |
Definition at line 97 of file rangetypes.h.
#define RANGESTRAT_OVERRIGHT RTOverRightStrategyNumber |
Definition at line 99 of file rangetypes.h.
#define RangeTypeGetOid | ( | r | ) | ((r)->rangetypid) |
Definition at line 35 of file rangetypes.h.
bool bounds_adjacent | ( | TypeCacheEntry * | typcache, |
RangeBound | boundA, | ||
RangeBound | boundB | ||
) |
Definition at line 757 of file rangetypes.c.
References Assert, cmp(), FmgrInfo::fn_oid, RangeBound::inclusive, RangeBound::lower, make_range(), OidIsValid, range_cmp_bound_values(), RangeIsEmpty, and TypeCacheEntry::rng_canonical_finfo.
Referenced by adjacent_cmp_bounds(), multirange_adjacent_multirange(), range_adjacent_internal(), and range_adjacent_multirange_internal().
Definition at line 73 of file rangetypes.h.
References PG_DETOAST_DATUM.
Referenced by calc_hist_selectivity(), compute_range_stats(), ExecWithoutOverlapsNotEmpty(), find_simplified_clause(), make_range(), multirange_constructor2(), multirange_gist_consistent(), multirange_in(), multirange_recv(), multirangesel(), range_agg_finalfn(), range_gist_class_split(), range_gist_consistent(), range_gist_double_sorting_split(), range_gist_fallback_split(), range_gist_penalty(), range_gist_picksplit(), range_gist_single_sorting_split(), range_gist_union(), rangesel(), spg_range_quad_choose(), spg_range_quad_inner_consistent(), spg_range_quad_leaf_consistent(), and spg_range_quad_picksplit().
RangeType* make_empty_range | ( | TypeCacheEntry * | typcache | ) |
Definition at line 2165 of file rangetypes.c.
References lower(), make_range(), and upper().
Referenced by multirange_agg_transfn(), multirange_get_union_range(), range_intersect_internal(), range_merge_from_multirange(), and range_minus_internal().
RangeType* make_range | ( | TypeCacheEntry * | typcache, |
RangeBound * | lower, | ||
RangeBound * | upper, | ||
bool | empty, | ||
struct Node * | escontext | ||
) |
Definition at line 1952 of file rangetypes.c.
References DatumGetRangeTypeP(), elog, ERROR, FmgrInfo::fn_oid, FunctionCallInvoke, InitFunctionCallInfoData, InvalidOid, LOCAL_FCINFO, lower(), OidIsValid, range(), range_serialize(), RangeIsEmpty, RangeTypePGetDatum(), TypeCacheEntry::rng_canonical_finfo, SOFT_ERROR_OCCURRED, and upper().
Referenced by bounds_adjacent(), make_empty_range(), multirange_get_union_range(), range_constructor2(), range_constructor3(), range_in(), range_intersect_internal(), range_merge_from_multirange(), range_minus_internal(), range_recv(), range_split_internal(), range_super_union(), and range_union_internal().
bool range_adjacent_internal | ( | TypeCacheEntry * | typcache, |
const RangeType * | r1, | ||
const RangeType * | r2 | ||
) |
Definition at line 798 of file rangetypes.c.
References bounds_adjacent(), elog, ERROR, range_deserialize(), and RangeTypeGetOid.
Referenced by multirange_canonicalize(), range_adjacent(), range_gist_consistent_int_range(), range_gist_consistent_leaf_range(), range_union_internal(), and spg_range_quad_leaf_consistent().
bool range_after_internal | ( | TypeCacheEntry * | typcache, |
const RangeType * | r1, | ||
const RangeType * | r2 | ||
) |
Definition at line 702 of file rangetypes.c.
References elog, ERROR, range_cmp_bounds(), range_deserialize(), and RangeTypeGetOid.
Referenced by range_after(), range_gist_consistent_int_range(), range_gist_consistent_leaf_range(), and spg_range_quad_leaf_consistent().
bool range_before_internal | ( | TypeCacheEntry * | typcache, |
const RangeType * | r1, | ||
const RangeType * | r2 | ||
) |
Definition at line 664 of file rangetypes.c.
References elog, ERROR, range_cmp_bounds(), range_deserialize(), and RangeTypeGetOid.
Referenced by multirange_canonicalize(), multirange_intersect_internal(), multirange_minus_internal(), range_before(), range_gist_consistent_int_range(), range_gist_consistent_leaf_range(), and spg_range_quad_leaf_consistent().
int range_cmp_bound_values | ( | TypeCacheEntry * | typcache, |
const RangeBound * | b1, | ||
const RangeBound * | b2 | ||
) |
Definition at line 2090 of file rangetypes.c.
References DatumGetInt32(), FunctionCall2Coll(), RangeBound::infinite, RangeBound::lower, TypeCacheEntry::rng_cmp_proc_finfo, TypeCacheEntry::rng_collation, and RangeBound::val.
Referenced by bounds_adjacent(), and range_serialize().
int range_cmp_bounds | ( | TypeCacheEntry * | typcache, |
const RangeBound * | b1, | ||
const RangeBound * | b2 | ||
) |
Definition at line 2016 of file rangetypes.c.
References DatumGetInt32(), FunctionCall2Coll(), RangeBound::inclusive, RangeBound::infinite, RangeBound::lower, TypeCacheEntry::rng_cmp_proc_finfo, TypeCacheEntry::rng_collation, and RangeBound::val.
Referenced by adjacent_cmp_bounds(), adjacent_inner_consistent(), bound_cmp(), calc_hist_selectivity_contained(), getQuadrant(), interval_cmp_lower(), interval_cmp_upper(), multirange_before_multirange_internal(), multirange_cmp(), multirange_contains_multirange_internal(), multirange_eq_internal(), multirange_overlaps_multirange_internal(), multirange_overleft_multirange(), multirange_overleft_range(), multirange_overright_multirange(), multirange_overright_range(), multirange_range_contains_bsearch_comparison(), multirange_range_overlaps_bsearch_comparison(), multirange_union_range_equal(), range_after_internal(), range_after_multirange_internal(), range_before_internal(), range_before_multirange_internal(), range_bound_qsort_cmp(), range_bounds_contains(), range_bounds_overlaps(), range_cmp(), range_compare(), range_contains_internal(), range_eq_internal(), range_gist_double_sorting_split(), range_gist_penalty(), range_intersect_internal(), range_minus_internal(), range_overlaps_internal(), range_overleft_internal(), range_overleft_multirange_internal(), range_overright_internal(), range_overright_multirange_internal(), range_split_internal(), range_super_union(), range_union_internal(), rbound_bsearch(), single_bound_cmp(), and spg_range_quad_inner_consistent().
int range_compare | ( | const void * | key1, |
const void * | key2, | ||
void * | arg | ||
) |
Definition at line 2129 of file rangetypes.c.
References arg, cmp(), range_cmp_bounds(), and range_deserialize().
Referenced by multirange_canonicalize().
bool range_contained_by_internal | ( | TypeCacheEntry * | typcache, |
const RangeType * | r1, | ||
const RangeType * | r2 | ||
) |
Definition at line 2618 of file rangetypes.c.
References range_contains_internal().
Referenced by range_contained_by(), range_gist_consistent_leaf_range(), and spg_range_quad_leaf_consistent().
bool range_contains_elem_internal | ( | TypeCacheEntry * | typcache, |
const RangeType * | r, | ||
Datum | val | ||
) |
Definition at line 2627 of file rangetypes.c.
References cmp(), DatumGetInt32(), FunctionCall2Coll(), lower(), range_deserialize(), TypeCacheEntry::rng_cmp_proc_finfo, TypeCacheEntry::rng_collation, upper(), and val.
Referenced by elem_contained_by_range(), range_contains_elem(), range_gist_consistent_int_element(), range_gist_consistent_leaf_element(), and spg_range_quad_leaf_consistent().
bool range_contains_internal | ( | TypeCacheEntry * | typcache, |
const RangeType * | r1, | ||
const RangeType * | r2 | ||
) |
Definition at line 2586 of file rangetypes.c.
References elog, ERROR, range_cmp_bounds(), range_deserialize(), and RangeTypeGetOid.
Referenced by range_contained_by_internal(), range_contains(), range_gist_consistent_int_range(), range_gist_consistent_leaf_range(), and spg_range_quad_leaf_consistent().
void range_deserialize | ( | TypeCacheEntry * | typcache, |
const RangeType * | range, | ||
RangeBound * | lower, | ||
RangeBound * | upper, | ||
bool * | empty | ||
) |
Definition at line 1856 of file rangetypes.c.
References Assert, att_addlength_pointer, att_align_pointer, fetch_att(), lower(), range(), RANGE_EMPTY, RANGE_HAS_LBOUND, RANGE_HAS_UBOUND, RANGE_LB_INC, RANGE_LB_INF, RANGE_UB_INC, RANGE_UB_INF, RangeTypeGetOid, TypeCacheEntry::rngelemtype, typalign, TypeCacheEntry::typalign, TypeCacheEntry::typbyval, TypeCacheEntry::type_id, TypeCacheEntry::typlen, upper(), and VARSIZE.
Referenced by calc_hist_selectivity(), compute_range_stats(), daterange_canonical(), find_simplified_clause(), getQuadrant(), hash_range(), hash_range_extended(), int4range_canonical(), int8range_canonical(), multirange_contains_range_internal(), multirange_overleft_range(), multirange_overright_range(), multirange_union_range_equal(), range_adjacent_internal(), range_adjacent_multirange_internal(), range_after_internal(), range_after_multirange_internal(), range_before_internal(), range_before_multirange_internal(), range_cmp(), range_compare(), range_contains_elem_internal(), range_contains_internal(), range_contains_multirange_internal(), range_eq_internal(), range_gist_double_sorting_split(), range_gist_penalty(), range_gist_single_sorting_split(), range_intersect_internal(), range_lower(), range_minus_internal(), range_out(), range_overlaps_internal(), range_overlaps_multirange_internal(), range_overleft_internal(), range_overleft_multirange_internal(), range_overright_internal(), range_overright_multirange_internal(), range_send(), range_split_internal(), range_super_union(), range_union_internal(), range_upper(), spg_range_quad_inner_consistent(), and spg_range_quad_picksplit().
bool range_eq_internal | ( | TypeCacheEntry * | typcache, |
const RangeType * | r1, | ||
const RangeType * | r2 | ||
) |
Definition at line 573 of file rangetypes.c.
References elog, ERROR, range_cmp_bounds(), range_deserialize(), and RangeTypeGetOid.
Referenced by range_eq(), range_gist_consistent_leaf_range(), range_gist_same(), range_ne_internal(), and spg_range_quad_leaf_consistent().
char range_get_flags | ( | const RangeType * | range | ) |
Definition at line 1923 of file rangetypes.c.
References range(), and VARSIZE.
Referenced by get_gist_range_class(), hash_range(), hash_range_extended(), range_empty(), range_gist_same(), range_lower_inc(), range_lower_inf(), range_out(), range_send(), range_super_union(), range_upper_inc(), and range_upper_inf().
TypeCacheEntry* range_get_typcache | ( | FunctionCallInfo | fcinfo, |
Oid | rngtypid | ||
) |
Definition at line 1703 of file rangetypes.c.
References elog, ERROR, FunctionCallInfoBaseData::flinfo, FmgrInfo::fn_extra, if(), lookup_type_cache(), TypeCacheEntry::rngelemtype, TypeCacheEntry::type_id, and TYPECACHE_RANGE_INFO.
Referenced by daterange_canonical(), elem_contained_by_range(), hash_range(), hash_range_extended(), int4range_canonical(), int8range_canonical(), multirange_gist_consistent(), range_adjacent(), range_after(), range_before(), range_cmp(), range_constructor2(), range_constructor3(), range_contained_by(), range_contains(), range_contains_elem(), range_eq(), range_gist_consistent(), range_gist_penalty(), range_gist_picksplit(), range_gist_same(), range_gist_union(), range_intersect(), range_intersect_agg_transfn(), range_lower(), range_merge(), range_minus(), range_ne(), range_overlaps(), range_overleft(), range_overright(), range_typanalyze(), range_union(), range_upper(), rangesel(), spg_range_quad_choose(), spg_range_quad_inner_consistent(), spg_range_quad_leaf_consistent(), and spg_range_quad_picksplit().
RangeType* range_intersect_internal | ( | TypeCacheEntry * | typcache, |
const RangeType * | r1, | ||
const RangeType * | r2 | ||
) |
Definition at line 1143 of file rangetypes.c.
References make_empty_range(), make_range(), range_cmp_bounds(), range_deserialize(), and range_overlaps_internal().
Referenced by multirange_intersect_internal(), range_intersect(), and range_intersect_agg_transfn().
RangeType* range_minus_internal | ( | TypeCacheEntry * | typcache, |
RangeType * | r1, | ||
RangeType * | r2 | ||
) |
Definition at line 993 of file rangetypes.c.
References elog, ereport, errcode(), errmsg(), ERROR, RangeBound::inclusive, RangeBound::lower, make_empty_range(), make_range(), range_cmp_bounds(), and range_deserialize().
Referenced by multirange_minus_internal(), and range_minus().
bool range_ne_internal | ( | TypeCacheEntry * | typcache, |
const RangeType * | r1, | ||
const RangeType * | r2 | ||
) |
Definition at line 618 of file rangetypes.c.
References range_eq_internal().
Referenced by range_ne().
bool range_overlaps_internal | ( | TypeCacheEntry * | typcache, |
const RangeType * | r1, | ||
const RangeType * | r2 | ||
) |
Definition at line 841 of file rangetypes.c.
References elog, ERROR, range_cmp_bounds(), range_deserialize(), and RangeTypeGetOid.
Referenced by multirange_intersect_internal(), multirange_minus_internal(), range_gist_consistent_int_range(), range_gist_consistent_leaf_range(), range_intersect_internal(), range_overlaps(), range_union_internal(), and spg_range_quad_leaf_consistent().
bool range_overleft_internal | ( | TypeCacheEntry * | typcache, |
const RangeType * | r1, | ||
const RangeType * | r2 | ||
) |
Definition at line 887 of file rangetypes.c.
References elog, ERROR, range_cmp_bounds(), range_deserialize(), and RangeTypeGetOid.
Referenced by multirange_intersect_internal(), range_gist_consistent_int_range(), range_gist_consistent_leaf_range(), range_overleft(), and spg_range_quad_leaf_consistent().
bool range_overright_internal | ( | TypeCacheEntry * | typcache, |
const RangeType * | r1, | ||
const RangeType * | r2 | ||
) |
Definition at line 928 of file rangetypes.c.
References elog, ERROR, range_cmp_bounds(), range_deserialize(), and RangeTypeGetOid.
Referenced by range_gist_consistent_int_range(), range_gist_consistent_leaf_range(), range_overright(), and spg_range_quad_leaf_consistent().
RangeType* range_serialize | ( | TypeCacheEntry * | typcache, |
RangeBound * | lower, | ||
RangeBound * | upper, | ||
bool | empty, | ||
struct Node * | escontext | ||
) |
Definition at line 1727 of file rangetypes.c.
References Assert, cmp(), datum_compute_size(), datum_write(), ereturn, errcode(), errmsg(), lower(), MAXALIGN, palloc0(), PG_DETOAST_DATUM_PACKED, PointerGetDatum(), range(), range_cmp_bound_values(), RANGE_EMPTY, RANGE_HAS_LBOUND, RANGE_HAS_UBOUND, RANGE_LB_INC, RANGE_LB_INF, RANGE_UB_INC, RANGE_UB_INF, TypeCacheEntry::rngelemtype, SET_VARSIZE, typalign, TypeCacheEntry::typalign, TypeCacheEntry::typbyval, TypeCacheEntry::type_id, TypeCacheEntry::typlen, TypeCacheEntry::typstorage, and upper().
Referenced by compute_range_stats(), daterange_canonical(), int4range_canonical(), int8range_canonical(), make_range(), multirangesel(), rangesel(), and spg_range_quad_picksplit().
void range_set_contain_empty | ( | RangeType * | range | ) |
Definition at line 1937 of file rangetypes.c.
References range(), RANGE_CONTAIN_EMPTY, and VARSIZE.
Referenced by range_super_union().
bool range_split_internal | ( | TypeCacheEntry * | typcache, |
const RangeType * | r1, | ||
const RangeType * | r2, | ||
RangeType ** | output1, | ||
RangeType ** | output2 | ||
) |
Definition at line 1182 of file rangetypes.c.
References RangeBound::inclusive, RangeBound::lower, make_range(), range_cmp_bounds(), and range_deserialize().
Referenced by multirange_minus_internal().
RangeType* range_union_internal | ( | TypeCacheEntry * | typcache, |
RangeType * | r1, | ||
RangeType * | r2, | ||
bool | strict | ||
) |
Definition at line 1052 of file rangetypes.c.
References DatumGetBool(), elog, ereport, errcode(), errmsg(), ERROR, make_range(), range_adjacent_internal(), range_cmp_bounds(), range_deserialize(), range_overlaps_internal(), and RangeTypeGetOid.
Referenced by multirange_canonicalize(), range_merge(), and range_union().
Definition at line 85 of file rangetypes.h.
References PointerGetDatum().
Referenced by make_range(), multirange_agg_transfn(), multirange_gist_compress(), multirange_out(), multirange_send(), multirange_unnest(), range_gist_class_split(), range_gist_fallback_split(), range_gist_single_sorting_split(), spg_range_quad_choose(), and spg_range_quad_picksplit().