65static bool range_parse(
const char *
string,
char *flags,
char **lbound_str,
66 char **ubound_str,
Node *escontext);
68 char **bound_str,
bool *infinite,
71 const char *ubound_str);
80 bool isLowerBound,
bool isInclusive,
82 Oid opfamily,
Oid rng_collation);
97 Node *escontext = fcinfo->context;
111 if (!
range_parse(input_str, &flags, &lbound_str, &ubound_str, escontext))
118 escontext, &
lower.val))
123 escontext, &
upper.val))
147 char *lbound_str = NULL;
148 char *ubound_str = NULL;
294 char *bound_data =
VARDATA(bound);
304 char *bound_data =
VARDATA(bound);
337 elog(
ERROR,
"type %u is not a range type", rngtypid);
354 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
355 errmsg(
"no binary input function available for type %s",
359 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
360 errmsg(
"no binary output function available for type %s",
395 lower.inclusive =
true;
400 upper.inclusive =
false;
425 (
errcode(ERRCODE_DATA_EXCEPTION),
426 errmsg(
"range constructor flags argument must not be null")));
463 if (empty ||
lower.infinite)
484 if (empty ||
upper.infinite)
593 if (empty1 && empty2)
595 if (empty1 != empty2)
685 if (empty1 || empty2)
723 if (empty1 || empty2)
790 boundB.
lower =
false;
791 r =
make_range(typcache, &boundA, &boundB,
false, NULL);
819 if (empty1 || empty2)
862 if (empty1 || empty2)
908 if (empty1 || empty2)
949 if (empty1 || empty2)
1014 if (empty1 || empty2)
1022 if (cmp_l1l2 < 0 && cmp_u1u2 > 0)
1024 (
errcode(ERRCODE_DATA_EXCEPTION),
1025 errmsg(
"result of range difference would not be contiguous")));
1027 if (cmp_l1u2 > 0 || cmp_u1l2 < 0)
1030 if (cmp_l1l2 >= 0 && cmp_u1u2 <= 0)
1033 if (cmp_l1l2 <= 0 && cmp_u1l2 >= 0 && cmp_u1u2 <= 0)
1036 lower2.
lower =
false;
1037 return make_range(typcache, &lower1, &lower2,
false, NULL);
1040 if (cmp_l1l2 >= 0 && cmp_u1u2 >= 0 && cmp_l1u2 <= 0)
1043 upper2.
lower =
true;
1044 return make_range(typcache, &upper2, &upper1,
false, NULL);
1047 elog(
ERROR,
"unexpected case in range_minus");
1070 elog(
ERROR,
"range types do not match");
1085 (
errcode(ERRCODE_DATA_EXCEPTION),
1086 errmsg(
"result of range union would not be contiguous")));
1089 result_lower = &lower1;
1091 result_lower = &lower2;
1094 result_upper = &upper1;
1096 result_upper = &upper2;
1098 return make_range(typcache, result_lower, result_upper,
false, NULL);
1139 elog(
ERROR,
"range types do not match");
1165 result_lower = &lower1;
1167 result_lower = &lower2;
1170 result_upper = &upper1;
1172 result_upper = &upper2;
1174 return make_range(typcache, result_lower, result_upper,
false, NULL);
1208 lower2.
lower =
false;
1210 upper2.
lower =
true;
1212 *output1 =
make_range(typcache, &lower1, &lower2,
false, NULL);
1213 *output2 =
make_range(typcache, &upper2, &upper1,
false, NULL);
1227 struct range_minus_multi_fctx
1234 struct range_minus_multi_fctx *fctx;
1258 elog(
ERROR,
"range types do not match");
1261 fctx = (
struct range_minus_multi_fctx *)
palloc(
sizeof(
struct range_minus_multi_fctx));
1270 elog(
ERROR,
"type %u is not a range type", rngtypid);
1345 if (cmp_l1l2 < 0 && cmp_u1u2 > 0)
1348 lower2.
lower =
false;
1349 outputs[0] =
make_range(typcache, &lower1, &lower2,
false, NULL);
1352 upper2.
lower =
true;
1353 outputs[1] =
make_range(typcache, &upper2, &upper1,
false, NULL);
1357 else if (cmp_l1u2 > 0 || cmp_u1l2 < 0)
1362 else if (cmp_l1l2 >= 0 && cmp_u1u2 <= 0)
1366 else if (cmp_l1l2 <= 0 && cmp_u1l2 >= 0 && cmp_u1u2 <= 0)
1369 lower2.
lower =
false;
1370 outputs[0] =
make_range(typcache, &lower1, &lower2,
false, NULL);
1373 else if (cmp_l1l2 >= 0 && cmp_u1u2 >= 0 && cmp_l1u2 <= 0)
1376 upper2.
lower =
true;
1377 outputs[0] =
make_range(typcache, &upper2, &upper1,
false, NULL);
1382 elog(
ERROR,
"unexpected case in range_minus_multi");
1398 elog(
ERROR,
"range_intersect_agg_transfn called in non-aggregate context");
1402 elog(
ERROR,
"range_intersect_agg must be called with a range");
1436 elog(
ERROR,
"range types do not match");
1444 if (empty1 && empty2)
1503 if (empty1 && empty2)
1592 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
1593 errmsg(
"could not identify a hash function for type %s",
1616 result ^= lower_hash;
1618 result ^= upper_hash;
1656 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
1657 errmsg(
"could not identify a hash function for type %s",
1680 result ^= lower_hash;
1682 result ^= upper_hash;
1699 Node *escontext = fcinfo->context;
1719 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1720 errmsg(
"integer out of range")));
1722 lower.inclusive =
true;
1732 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1733 errmsg(
"integer out of range")));
1735 upper.inclusive =
false;
1746 Node *escontext = fcinfo->context;
1766 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1767 errmsg(
"bigint out of range")));
1769 lower.inclusive =
true;
1779 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1780 errmsg(
"bigint out of range")));
1782 upper.inclusive =
false;
1793 Node *escontext = fcinfo->context;
1815 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
1816 errmsg(
"date out of range")));
1818 lower.inclusive =
true;
1830 (
errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
1831 errmsg(
"date out of range")));
1833 upper.inclusive =
false;
1939 if (typcache == NULL ||
1940 typcache->
type_id != rngtypid)
1944 elog(
ERROR,
"type %u is not a range type", rngtypid);
1960 bool empty,
struct Node *escontext)
1988 (
errcode(ERRCODE_DATA_EXCEPTION),
1989 errmsg(
"range lower bound must be less than or equal to range upper bound")));
1997 if (
lower->infinite)
1999 else if (
lower->inclusive)
2001 if (
upper->infinite)
2003 else if (
upper->inclusive)
2034 typlen, typstorage);
2044 typlen, typstorage);
2048 msize +=
sizeof(char);
2057 ptr = (
char *) (
range + 1);
2073 *((
char *) ptr) = flags;
2117 lbound =
fetch_att(ptr, typbyval, typlen);
2127 ubound =
fetch_att(ptr, typbyval, typlen);
2137 lower->val = lbound;
2140 lower->lower =
true;
2142 upper->val = ubound;
2145 upper->lower =
false;
2185 bool empty,
struct Node *escontext)
2206 fcinfo->args[0].isnull =
false;
2215 elog(
ERROR,
"function %u returned NULL",
2265 return b1->
lower ? -1 : 1;
2268 return b1->
lower ? -1 : 1;
2270 return b2->
lower ? 1 : -1;
2292 return b1->
lower ? 1 : -1;
2295 return b1->
lower ? 1 : -1;
2297 return b2->
lower ? -1 : 1;
2338 return b1->
lower ? -1 : 1;
2341 return b1->
lower ? -1 : 1;
2343 return b2->
lower ? 1 : -1;
2377 if (empty1 && empty2)
2403 lower.infinite =
false;
2404 lower.inclusive =
false;
2408 upper.infinite =
false;
2409 upper.inclusive =
false;
2410 upper.lower =
false;
2483 if (flags_str[0] ==
'\0' ||
2484 flags_str[1] ==
'\0' ||
2485 flags_str[2] !=
'\0')
2487 (
errcode(ERRCODE_SYNTAX_ERROR),
2488 errmsg(
"invalid range bound flags"),
2489 errhint(
"Valid values are \"[]\", \"[)\", \"(]\", and \"()\".")));
2491 switch (flags_str[0])
2500 (
errcode(ERRCODE_SYNTAX_ERROR),
2501 errmsg(
"invalid range bound flags"),
2502 errhint(
"Valid values are \"[]\", \"[)\", \"(]\", and \"()\".")));
2505 switch (flags_str[1])
2514 (
errcode(ERRCODE_SYNTAX_ERROR),
2515 errmsg(
"invalid range bound flags"),
2516 errhint(
"Valid values are \"[]\", \"[)\", \"(]\", and \"()\".")));
2555 char **ubound_str,
Node *escontext)
2557 const char *ptr =
string;
2563 while (*ptr !=
'\0' && isspace((
unsigned char) *ptr))
2577 while (*ptr !=
'\0' && isspace((
unsigned char) *ptr))
2583 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
2584 errmsg(
"malformed range literal: \"%s\"",
2586 errdetail(
"Junk after \"empty\" key word.")));
2596 else if (*ptr ==
'(')
2600 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
2601 errmsg(
"malformed range literal: \"%s\"",
2603 errdetail(
"Missing left parenthesis or bracket.")));
2615 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
2616 errmsg(
"malformed range literal: \"%s\"",
2618 errdetail(
"Missing comma after lower bound.")));
2631 else if (*ptr ==
')')
2635 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
2636 errmsg(
"malformed range literal: \"%s\"",
2641 while (*ptr !=
'\0' && isspace((
unsigned char) *ptr))
2646 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
2647 errmsg(
"malformed range literal: \"%s\"",
2649 errdetail(
"Junk after right parenthesis or bracket.")));
2671 char **bound_str,
bool *infinite,
Node *escontext)
2676 if (*ptr ==
',' || *ptr ==
')' || *ptr ==
']')
2684 bool inquote =
false;
2687 while (inquote || !(*ptr ==
',' || *ptr ==
')' || *ptr ==
']'))
2693 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
2694 errmsg(
"malformed range literal: \"%s\"",
2696 errdetail(
"Unexpected end of input.")));
2701 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
2702 errmsg(
"malformed range literal: \"%s\"",
2704 errdetail(
"Unexpected end of input.")));
2711 else if (*ptr ==
'"')
2723 *bound_str =
buf.data;
2778 nq = (
value[0] ==
'\0');
2779 for (ptr =
value; *ptr; ptr++)
2783 if (ch ==
'"' || ch ==
'\\' ||
2784 ch ==
'(' || ch ==
')' ||
2785 ch ==
'[' || ch ==
']' ||
2787 isspace((
unsigned char) ch))
2797 for (ptr =
value; *ptr; ptr++)
2801 if (ch ==
'"' || ch ==
'\\')
2829 elog(
ERROR,
"range types do not match");
2871 if (!
lower.infinite)
2882 if (!
upper.infinite)
2907#define TYPE_IS_PACKABLE(typlen, typstorage) \
2908 ((typlen) == -1 && (typstorage) != TYPSTORAGE_PLAIN)
2916 int16 typlen,
char typstorage)
2942 int16 typlen,
char typstorage)
2951 data_length = typlen;
2953 else if (typlen == -1)
2964 elog(
ERROR,
"cannot store a toast pointer inside a range");
2971 memcpy(ptr,
val, data_length);
2979 memcpy(ptr + 1,
VARDATA(
val), data_length - 1);
2986 memcpy(ptr,
val, data_length);
2989 else if (typlen == -2)
3001 data_length = typlen;
3027 if (!
IsA(rangeExpr,
Const) || ((
Const *) rangeExpr)->constisnull)
3054 Expr *lowerExpr = NULL;
3055 Expr *upperExpr = NULL;
3085 if (!
lower.infinite)
3094 if (lowerExpr == NULL)
3098 if (!
upper.infinite)
3101 if (!
lower.infinite)
3110 if (upperExpr == NULL)
3114 if (lowerExpr != NULL && upperExpr != NULL)
3116 else if (lowerExpr != NULL)
3117 return (
Node *) lowerExpr;
3118 else if (upperExpr != NULL)
3119 return (
Node *) upperExpr;
3141 bool isLowerBound,
bool isInclusive,
3143 Oid opfamily,
Oid rng_collation)
3147 bool elemByValue = typeCache->
typbyval;
Datum numeric_sub(PG_FUNCTION_ARGS)
Datum numeric_float8(PG_FUNCTION_ARGS)
#define OidIsValid(objectId)
bool contain_subplans(Node *clause)
bool contain_volatile_functions(Node *clause)
void cost_qual_eval_node(QualCost *cost, Node *qual, PlannerInfo *root)
static Datum DateADTGetDatum(DateADT X)
#define DATE_NOT_FINITE(j)
static DateADT DatumGetDateADT(Datum X)
int errdetail(const char *fmt,...)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereturn(context, dummy_value,...)
#define ereport(elevel,...)
Datum FunctionCall2Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2)
void fmgr_info_cxt(Oid functionId, FmgrInfo *finfo, MemoryContext mcxt)
bytea * SendFunctionCall(FmgrInfo *flinfo, Datum val)
bool InputFunctionCallSafe(FmgrInfo *flinfo, char *str, Oid typioparam, int32 typmod, Node *escontext, Datum *result)
char * OutputFunctionCall(FmgrInfo *flinfo, Datum val)
Oid get_fn_expr_argtype(FmgrInfo *flinfo, int argnum)
Datum FunctionCall1Coll(FmgrInfo *flinfo, Oid collation, Datum arg1)
Oid get_fn_expr_rettype(FmgrInfo *flinfo)
Datum ReceiveFunctionCall(FmgrInfo *flinfo, StringInfo buf, Oid typioparam, int32 typmod)
#define PG_FREE_IF_COPY(ptr, n)
#define PG_GETARG_TEXT_PP(n)
#define PG_RETURN_BYTEA_P(x)
#define DirectFunctionCall2(func, arg1, arg2)
#define PG_RETURN_FLOAT8(x)
#define PG_GETARG_POINTER(n)
#define InitFunctionCallInfoData(Fcinfo, Flinfo, Nargs, Collation, Context, Resultinfo)
#define PG_RETURN_CSTRING(x)
#define DirectFunctionCall1(func, arg1)
#define PG_GETARG_DATUM(n)
#define LOCAL_FCINFO(name, nargs)
#define PG_GETARG_CSTRING(n)
#define PG_GETARG_INT64(n)
#define PG_DETOAST_DATUM_PACKED(datum)
#define PG_RETURN_UINT64(x)
#define FunctionCallInvoke(fcinfo)
#define PG_RETURN_INT32(x)
#define PG_GETARG_INT32(n)
#define PG_RETURN_DATUM(x)
#define PG_RETURN_POINTER(x)
#define PG_RETURN_BOOL(x)
#define SRF_IS_FIRSTCALL()
#define SRF_PERCALL_SETUP()
#define SRF_RETURN_NEXT(_funcctx, _result)
#define SRF_FIRSTCALL_INIT()
#define SRF_RETURN_DONE(_funcctx)
uint32 hash_bytes_uint32(uint32 k)
#define ROTATE_HIGH_AND_LOW_32BITS(v)
static Datum hash_uint32_extended(uint32 k, uint64 seed)
Assert(PointerIsAligned(start, uint64))
if(TABLE==NULL||TABLE_index==NULL)
bool type_is_range(Oid typid)
Oid get_opfamily_member(Oid opfamily, Oid lefttype, Oid righttype, int16 strategy)
void get_type_io_data(Oid typid, IOFuncSelector which_func, int16 *typlen, bool *typbyval, char *typalign, char *typdelim, Oid *typioparam, Oid *func)
Node * makeBoolConst(bool value, bool isnull)
Expr * make_andclause(List *andclauses)
Expr * make_opclause(Oid opno, Oid opresulttype, bool opretset, Expr *leftop, Expr *rightop, Oid opcollid, Oid inputcollid)
Const * makeConst(Oid consttype, int32 consttypmod, Oid constcollid, int constlen, Datum constvalue, bool constisnull, bool constbyval)
void * MemoryContextAlloc(MemoryContext context, Size size)
char * pstrdup(const char *in)
void pfree(void *pointer)
void * palloc0(Size size)
#define SOFT_ERROR_OCCURRED(escontext)
int AggCheckCallContext(FunctionCallInfo fcinfo, MemoryContext *aggcontext)
#define IsA(nodeptr, _type_)
Datum lower(PG_FUNCTION_ARGS)
Datum upper(PG_FUNCTION_ARGS)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
static uint32 pg_rotate_left32(uint32 word, int n)
static int list_length(const List *l)
#define list_make2(x1, x2)
int pg_strncasecmp(const char *s1, const char *s2, size_t n)
static uint32 DatumGetUInt32(Datum X)
static Datum Int64GetDatum(int64 X)
static uint64 DatumGetUInt64(Datum X)
static int64 DatumGetInt64(Datum X)
static Datum PointerGetDatum(const void *X)
static float8 DatumGetFloat8(Datum X)
static char * DatumGetCString(Datum X)
static Pointer DatumGetPointer(Datum X)
static Datum Int32GetDatum(int32 X)
static int32 DatumGetInt32(Datum X)
Datum range_empty(PG_FUNCTION_ARGS)
Datum range_out(PG_FUNCTION_ARGS)
Datum tstzrange_subdiff(PG_FUNCTION_ARGS)
Datum range_lower(PG_FUNCTION_ARGS)
bool range_ne_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
int range_cmp_bounds(TypeCacheEntry *typcache, const RangeBound *b1, const RangeBound *b2)
Datum hash_range(PG_FUNCTION_ARGS)
Datum range_cmp(PG_FUNCTION_ARGS)
Datum range_in(PG_FUNCTION_ARGS)
Datum range_sortsupport(PG_FUNCTION_ARGS)
bool range_split_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2, RangeType **output1, RangeType **output2)
static int range_fast_cmp(Datum a, Datum b, SortSupport ssup)
Datum daterange_canonical(PG_FUNCTION_ARGS)
Datum range_le(PG_FUNCTION_ARGS)
Datum range_before(PG_FUNCTION_ARGS)
RangeType * range_serialize(TypeCacheEntry *typcache, RangeBound *lower, RangeBound *upper, bool empty, struct Node *escontext)
Datum int4range_subdiff(PG_FUNCTION_ARGS)
Datum int8range_canonical(PG_FUNCTION_ARGS)
bool range_contained_by_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
#define TYPE_IS_PACKABLE(typlen, typstorage)
RangeType * make_range(TypeCacheEntry *typcache, RangeBound *lower, RangeBound *upper, bool empty, struct Node *escontext)
Datum range_lower_inc(PG_FUNCTION_ARGS)
Datum range_intersect_agg_transfn(PG_FUNCTION_ARGS)
bool range_contains_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
bool range_after_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
static bool range_parse(const char *string, char *flags, char **lbound_str, char **ubound_str, Node *escontext)
static char * range_deparse(char flags, const char *lbound_str, const char *ubound_str)
bool bounds_adjacent(TypeCacheEntry *typcache, RangeBound boundA, RangeBound boundB)
bool range_overlaps_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
Datum range_minus_multi(PG_FUNCTION_ARGS)
Datum range_lower_inf(PG_FUNCTION_ARGS)
Datum range_upper_inc(PG_FUNCTION_ARGS)
bool range_before_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
Datum elem_contained_by_range(PG_FUNCTION_ARGS)
static RangeIOData * get_range_io_data(FunctionCallInfo fcinfo, Oid rngtypid, IOFuncSelector func)
Datum range_overleft(PG_FUNCTION_ARGS)
Datum range_contained_by(PG_FUNCTION_ARGS)
static Pointer datum_write(Pointer ptr, Datum datum, bool typbyval, char typalign, int16 typlen, char typstorage)
Datum range_constructor2(PG_FUNCTION_ARGS)
Datum range_adjacent(PG_FUNCTION_ARGS)
Datum range_gt(PG_FUNCTION_ARGS)
bool range_overright_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
bool range_contains_elem_internal(TypeCacheEntry *typcache, const RangeType *r, Datum val)
Datum range_overright(PG_FUNCTION_ARGS)
Datum range_contains(PG_FUNCTION_ARGS)
Datum range_intersect(PG_FUNCTION_ARGS)
Datum range_eq(PG_FUNCTION_ARGS)
RangeType * range_intersect_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
Datum range_recv(PG_FUNCTION_ARGS)
RangeType * range_minus_internal(TypeCacheEntry *typcache, RangeType *r1, RangeType *r2)
void range_deserialize(TypeCacheEntry *typcache, const RangeType *range, RangeBound *lower, RangeBound *upper, bool *empty)
Datum daterange_subdiff(PG_FUNCTION_ARGS)
static char * range_bound_escape(const char *value)
RangeType * range_union_internal(TypeCacheEntry *typcache, RangeType *r1, RangeType *r2, bool strict)
Datum range_lt(PG_FUNCTION_ARGS)
static Size datum_compute_size(Size data_length, Datum val, bool typbyval, char typalign, int16 typlen, char typstorage)
Datum int8range_subdiff(PG_FUNCTION_ARGS)
bool range_eq_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
Datum range_upper_inf(PG_FUNCTION_ARGS)
Datum int4range_canonical(PG_FUNCTION_ARGS)
Datum range_ge(PG_FUNCTION_ARGS)
Datum range_overlaps(PG_FUNCTION_ARGS)
Datum range_contains_elem_support(PG_FUNCTION_ARGS)
Datum range_upper(PG_FUNCTION_ARGS)
bool range_adjacent_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
Datum elem_contained_by_range_support(PG_FUNCTION_ARGS)
void range_set_contain_empty(RangeType *range)
Datum range_constructor3(PG_FUNCTION_ARGS)
TypeCacheEntry * range_get_typcache(FunctionCallInfo fcinfo, Oid rngtypid)
static Expr * build_bound_expr(Expr *elemExpr, Datum val, bool isLowerBound, bool isInclusive, TypeCacheEntry *typeCache, Oid opfamily, Oid rng_collation)
char range_get_flags(const RangeType *range)
Datum hash_range_extended(PG_FUNCTION_ARGS)
static const char * range_parse_bound(const char *string, const char *ptr, char **bound_str, bool *infinite, Node *escontext)
static char range_parse_flags(const char *flags_str)
Datum tsrange_subdiff(PG_FUNCTION_ARGS)
bool range_overleft_internal(TypeCacheEntry *typcache, const RangeType *r1, const RangeType *r2)
int range_compare(const void *key1, const void *key2, void *arg)
struct RangeIOData RangeIOData
Datum range_after(PG_FUNCTION_ARGS)
static Node * find_simplified_clause(PlannerInfo *root, Expr *rangeExpr, Expr *elemExpr)
Datum range_union(PG_FUNCTION_ARGS)
Datum range_minus(PG_FUNCTION_ARGS)
void range_minus_multi_internal(TypeCacheEntry *typcache, RangeType *r1, RangeType *r2, RangeType **outputs, int *outputn)
RangeType * make_empty_range(TypeCacheEntry *typcache)
Datum range_ne(PG_FUNCTION_ARGS)
int range_cmp_bound_values(TypeCacheEntry *typcache, const RangeBound *b1, const RangeBound *b2)
Datum range_merge(PG_FUNCTION_ARGS)
Datum range_send(PG_FUNCTION_ARGS)
Datum range_contains_elem(PG_FUNCTION_ARGS)
Datum numrange_subdiff(PG_FUNCTION_ARGS)
static RangeType * DatumGetRangeTypeP(Datum X)
#define RANGE_CONTAIN_EMPTY
#define RANGE_HAS_UBOUND(flags)
static Datum RangeTypePGetDatum(const RangeType *X)
#define PG_RETURN_RANGE_P(x)
#define RANGE_HAS_LBOUND(flags)
#define PG_GETARG_RANGE_P(n)
#define RANGE_EMPTY_LITERAL
#define RangeTypeGetOid(r)
static int cmp(const chr *x, const chr *y, size_t len)
static struct cvec * range(struct vars *v, chr a, chr b, int cases)
struct SortSupportData * SortSupport
void check_stack_depth(void)
#define BTGreaterStrategyNumber
#define BTLessStrategyNumber
#define BTLessEqualStrategyNumber
#define BTGreaterEqualStrategyNumber
struct StringInfoData * StringInfo
void appendBinaryStringInfo(StringInfo str, const void *data, int datalen)
void appendStringInfoString(StringInfo str, const char *s)
void appendStringInfoChar(StringInfo str, char ch)
void initStringInfo(StringInfo str)
MemoryContext multi_call_memory_ctx
TypeCacheEntry * typcache
int(* comparator)(Datum x, Datum y, SortSupport ssup)
FmgrInfo rng_cmp_proc_finfo
struct TypeCacheEntry * rngelemtype
FmgrInfo hash_extended_proc_finfo
FmgrInfo rng_canonical_finfo
#define att_align_pointer(cur_offset, attalign, attlen, attptr)
#define att_align_nominal(cur_offset, attalign)
#define att_align_datum(cur_offset, attalign, attlen, attdatum)
#define att_addlength_pointer(cur_offset, attlen, attptr)
static Datum fetch_att(const void *T, bool attbyval, int attlen)
#define att_addlength_datum(cur_offset, attlen, attdatum)
static void store_att_byval(void *T, Datum newdatum, int attlen)
TypeCacheEntry * lookup_type_cache(Oid type_id, int flags)
#define TYPECACHE_HASH_PROC_FINFO
#define TYPECACHE_RANGE_INFO
#define TYPECACHE_HASH_EXTENDED_PROC_FINFO
#define PG_GETARG_TIMESTAMP(n)
static bool VARATT_IS_SHORT(const void *PTR)
static bool VARATT_CAN_MAKE_SHORT(const void *PTR)
static bool VARATT_IS_EXTERNAL(const void *PTR)
static Size VARSIZE(const void *PTR)
static char * VARDATA(const void *PTR)
static Size VARATT_CONVERTED_SHORT_SIZE(const void *PTR)
static void SET_VARSIZE_SHORT(void *PTR, Size len)
static void SET_VARSIZE(void *PTR, Size len)
static Size VARSIZE_SHORT(const void *PTR)
char * text_to_cstring(const text *t)