Run pgindent on range type files, per request from Tom.
This commit is contained in:
parent
5b5985e6c0
commit
cdaa45fd4b
@ -654,9 +654,9 @@ RemoveTypeById(Oid typeOid)
|
||||
EnumValuesDelete(typeOid);
|
||||
|
||||
/*
|
||||
* If it is a range type, delete the pg_range entries too; we
|
||||
* don't bother with making dependency entries for those, so it
|
||||
* has to be done "by hand" here.
|
||||
* If it is a range type, delete the pg_range entries too; we don't bother
|
||||
* with making dependency entries for those, so it has to be done "by
|
||||
* hand" here.
|
||||
*/
|
||||
if (((Form_pg_type) GETSTRUCT(tup))->typtype == TYPTYPE_RANGE)
|
||||
RangeDelete(typeOid);
|
||||
@ -744,7 +744,8 @@ DefineDomain(CreateDomainStmt *stmt)
|
||||
/*
|
||||
* Base type must be a plain base type, another domain, an enum or a range
|
||||
* type. Domains over pseudotypes would create a security hole. Domains
|
||||
* over composite types might be made to work in the future, but not today.
|
||||
* over composite types might be made to work in the future, but not
|
||||
* today.
|
||||
*/
|
||||
typtype = baseType->typtype;
|
||||
if (typtype != TYPTYPE_BASE &&
|
||||
@ -2549,6 +2550,7 @@ validateDomainConstraint(Oid domainoid, char *ccbin)
|
||||
|
||||
FreeExecutorState(estate);
|
||||
}
|
||||
|
||||
/*
|
||||
* get_rels_with_domain
|
||||
*
|
||||
|
@ -259,8 +259,8 @@ range_recv(PG_FUNCTION_ARGS)
|
||||
range = make_range(fcinfo, &lower, &upper, flags & RANGE_EMPTY);
|
||||
|
||||
/*
|
||||
* XXX if the subtype is pass-by-val, we should pfree the upper and
|
||||
* lower bounds here.
|
||||
* XXX if the subtype is pass-by-val, we should pfree the upper and lower
|
||||
* bounds here.
|
||||
*/
|
||||
|
||||
PG_RETURN_RANGE(range);
|
||||
@ -571,9 +571,12 @@ range_eq(PG_FUNCTION_ARGS)
|
||||
RangeType *r1 = PG_GETARG_RANGE(0);
|
||||
RangeType *r2 = PG_GETARG_RANGE(1);
|
||||
|
||||
RangeBound lower1, lower2;
|
||||
RangeBound upper1, upper2;
|
||||
bool empty1, empty2;
|
||||
RangeBound lower1,
|
||||
lower2;
|
||||
RangeBound upper1,
|
||||
upper2;
|
||||
bool empty1,
|
||||
empty2;
|
||||
|
||||
range_deserialize(fcinfo, r1, &lower1, &upper1, &empty1);
|
||||
range_deserialize(fcinfo, r2, &lower2, &upper2, &empty2);
|
||||
@ -612,8 +615,10 @@ range_contains_elem(PG_FUNCTION_ARGS)
|
||||
RangeType *r2;
|
||||
Datum val = PG_GETARG_DATUM(1);
|
||||
|
||||
RangeBound lower1, lower2;
|
||||
RangeBound upper1, upper2;
|
||||
RangeBound lower1,
|
||||
lower2;
|
||||
RangeBound upper1,
|
||||
upper2;
|
||||
bool empty1;
|
||||
|
||||
range_deserialize(fcinfo, r1, &lower1, &upper1, &empty1);
|
||||
@ -651,8 +656,10 @@ elem_contained_by_range(PG_FUNCTION_ARGS)
|
||||
RangeType *r2;
|
||||
Datum val = PG_GETARG_DATUM(0);
|
||||
|
||||
RangeBound lower1, lower2;
|
||||
RangeBound upper1, upper2;
|
||||
RangeBound lower1,
|
||||
lower2;
|
||||
RangeBound upper1,
|
||||
upper2;
|
||||
bool empty1;
|
||||
|
||||
range_deserialize(fcinfo, r1, &lower1, &upper1, &empty1);
|
||||
@ -689,9 +696,12 @@ range_before(PG_FUNCTION_ARGS)
|
||||
RangeType *r1 = PG_GETARG_RANGE(0);
|
||||
RangeType *r2 = PG_GETARG_RANGE(1);
|
||||
|
||||
RangeBound lower1, lower2;
|
||||
RangeBound upper1, upper2;
|
||||
bool empty1, empty2;
|
||||
RangeBound lower1,
|
||||
lower2;
|
||||
RangeBound upper1,
|
||||
upper2;
|
||||
bool empty1,
|
||||
empty2;
|
||||
|
||||
range_deserialize(fcinfo, r1, &lower1, &upper1, &empty1);
|
||||
range_deserialize(fcinfo, r2, &lower2, &upper2, &empty2);
|
||||
@ -718,9 +728,12 @@ range_after(PG_FUNCTION_ARGS)
|
||||
RangeType *r1 = PG_GETARG_RANGE(0);
|
||||
RangeType *r2 = PG_GETARG_RANGE(1);
|
||||
|
||||
RangeBound lower1, lower2;
|
||||
RangeBound upper1, upper2;
|
||||
bool empty1, empty2;
|
||||
RangeBound lower1,
|
||||
lower2;
|
||||
RangeBound upper1,
|
||||
upper2;
|
||||
bool empty1,
|
||||
empty2;
|
||||
|
||||
range_deserialize(fcinfo, r1, &lower1, &upper1, &empty1);
|
||||
range_deserialize(fcinfo, r2, &lower2, &upper2, &empty2);
|
||||
@ -741,16 +754,20 @@ range_after(PG_FUNCTION_ARGS)
|
||||
PG_RETURN_BOOL(false);
|
||||
}
|
||||
|
||||
Datum range_adjacent(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
range_adjacent(PG_FUNCTION_ARGS)
|
||||
{
|
||||
RangeType *r1 = PG_GETARG_RANGE(0);
|
||||
RangeType *r2 = PG_GETARG_RANGE(1);
|
||||
|
||||
RangeTypeInfo rngtypinfo;
|
||||
|
||||
RangeBound lower1, lower2;
|
||||
RangeBound upper1, upper2;
|
||||
bool empty1, empty2;
|
||||
RangeBound lower1,
|
||||
lower2;
|
||||
RangeBound upper1,
|
||||
upper2;
|
||||
bool empty1,
|
||||
empty2;
|
||||
|
||||
range_deserialize(fcinfo, r1, &lower1, &upper1, &empty1);
|
||||
range_deserialize(fcinfo, r2, &lower2, &upper2, &empty2);
|
||||
@ -766,12 +783,12 @@ Datum range_adjacent(PG_FUNCTION_ARGS)
|
||||
errmsg("undefined for empty ranges")));
|
||||
|
||||
/*
|
||||
* For two ranges to be adjacent, the lower boundary of one range
|
||||
* has to match the upper boundary of the other. However, the
|
||||
* inclusivity of those two boundaries must also be different.
|
||||
* For two ranges to be adjacent, the lower boundary of one range has to
|
||||
* match the upper boundary of the other. However, the inclusivity of
|
||||
* those two boundaries must also be different.
|
||||
*
|
||||
* The semantics for range_cmp_bounds aren't quite what we need
|
||||
* here, so we do the comparison more directly.
|
||||
* The semantics for range_cmp_bounds aren't quite what we need here, so
|
||||
* we do the comparison more directly.
|
||||
*/
|
||||
|
||||
range_gettypinfo(fcinfo, lower1.rngtypid, &rngtypinfo);
|
||||
@ -801,9 +818,12 @@ range_overlaps(PG_FUNCTION_ARGS)
|
||||
RangeType *r1 = PG_GETARG_RANGE(0);
|
||||
RangeType *r2 = PG_GETARG_RANGE(1);
|
||||
|
||||
RangeBound lower1, lower2;
|
||||
RangeBound upper1, upper2;
|
||||
bool empty1, empty2;
|
||||
RangeBound lower1,
|
||||
lower2;
|
||||
RangeBound upper1,
|
||||
upper2;
|
||||
bool empty1,
|
||||
empty2;
|
||||
|
||||
range_deserialize(fcinfo, r1, &lower1, &upper1, &empty1);
|
||||
range_deserialize(fcinfo, r2, &lower2, &upper2, &empty2);
|
||||
@ -833,9 +853,12 @@ range_overleft(PG_FUNCTION_ARGS)
|
||||
RangeType *r1 = PG_GETARG_RANGE(0);
|
||||
RangeType *r2 = PG_GETARG_RANGE(1);
|
||||
|
||||
RangeBound lower1, lower2;
|
||||
RangeBound upper1, upper2;
|
||||
bool empty1, empty2;
|
||||
RangeBound lower1,
|
||||
lower2;
|
||||
RangeBound upper1,
|
||||
upper2;
|
||||
bool empty1,
|
||||
empty2;
|
||||
|
||||
range_deserialize(fcinfo, r1, &lower1, &upper1, &empty1);
|
||||
range_deserialize(fcinfo, r2, &lower2, &upper2, &empty2);
|
||||
@ -860,9 +883,12 @@ range_overright(PG_FUNCTION_ARGS)
|
||||
RangeType *r1 = PG_GETARG_RANGE(0);
|
||||
RangeType *r2 = PG_GETARG_RANGE(1);
|
||||
|
||||
RangeBound lower1, lower2;
|
||||
RangeBound upper1, upper2;
|
||||
bool empty1, empty2;
|
||||
RangeBound lower1,
|
||||
lower2;
|
||||
RangeBound upper1,
|
||||
upper2;
|
||||
bool empty1,
|
||||
empty2;
|
||||
|
||||
range_deserialize(fcinfo, r1, &lower1, &upper1, &empty1);
|
||||
range_deserialize(fcinfo, r2, &lower2, &upper2, &empty2);
|
||||
@ -889,11 +915,17 @@ range_minus(PG_FUNCTION_ARGS)
|
||||
RangeType *r1 = PG_GETARG_RANGE(0);
|
||||
RangeType *r2 = PG_GETARG_RANGE(1);
|
||||
|
||||
RangeBound lower1, lower2;
|
||||
RangeBound upper1, upper2;
|
||||
bool empty1, empty2;
|
||||
RangeBound lower1,
|
||||
lower2;
|
||||
RangeBound upper1,
|
||||
upper2;
|
||||
bool empty1,
|
||||
empty2;
|
||||
|
||||
int cmp_l1l2, cmp_l1u2, cmp_u1l2, cmp_u1u2;
|
||||
int cmp_l1l2,
|
||||
cmp_l1u2,
|
||||
cmp_u1l2,
|
||||
cmp_u1u2;
|
||||
|
||||
range_deserialize(fcinfo, r1, &lower1, &upper1, &empty1);
|
||||
range_deserialize(fcinfo, r2, &lower2, &upper2, &empty2);
|
||||
@ -946,9 +978,12 @@ range_union(PG_FUNCTION_ARGS)
|
||||
RangeType *r1 = PG_GETARG_RANGE(0);
|
||||
RangeType *r2 = PG_GETARG_RANGE(1);
|
||||
|
||||
RangeBound lower1, lower2;
|
||||
RangeBound upper1, upper2;
|
||||
bool empty1, empty2;
|
||||
RangeBound lower1,
|
||||
lower2;
|
||||
RangeBound upper1,
|
||||
upper2;
|
||||
bool empty1,
|
||||
empty2;
|
||||
RangeBound *result_lower;
|
||||
RangeBound *result_upper;
|
||||
|
||||
@ -985,9 +1020,12 @@ range_intersect(PG_FUNCTION_ARGS)
|
||||
RangeType *r1 = PG_GETARG_RANGE(0);
|
||||
RangeType *r2 = PG_GETARG_RANGE(1);
|
||||
|
||||
RangeBound lower1, lower2;
|
||||
RangeBound upper1, upper2;
|
||||
bool empty1, empty2;
|
||||
RangeBound lower1,
|
||||
lower2;
|
||||
RangeBound upper1,
|
||||
upper2;
|
||||
bool empty1,
|
||||
empty2;
|
||||
RangeBound *result_lower;
|
||||
RangeBound *result_upper;
|
||||
|
||||
@ -1018,9 +1056,12 @@ range_cmp(PG_FUNCTION_ARGS)
|
||||
RangeType *r1 = PG_GETARG_RANGE(0);
|
||||
RangeType *r2 = PG_GETARG_RANGE(1);
|
||||
|
||||
RangeBound lower1, lower2;
|
||||
RangeBound upper1, upper2;
|
||||
bool empty1, empty2;
|
||||
RangeBound lower1,
|
||||
lower2;
|
||||
RangeBound upper1,
|
||||
upper2;
|
||||
bool empty1,
|
||||
empty2;
|
||||
|
||||
int cmp;
|
||||
|
||||
@ -1049,6 +1090,7 @@ Datum
|
||||
range_lt(PG_FUNCTION_ARGS)
|
||||
{
|
||||
int cmp = range_cmp(fcinfo);
|
||||
|
||||
PG_RETURN_BOOL(cmp < 0);
|
||||
}
|
||||
|
||||
@ -1056,6 +1098,7 @@ Datum
|
||||
range_le(PG_FUNCTION_ARGS)
|
||||
{
|
||||
int cmp = range_cmp(fcinfo);
|
||||
|
||||
PG_RETURN_BOOL(cmp <= 0);
|
||||
}
|
||||
|
||||
@ -1063,6 +1106,7 @@ Datum
|
||||
range_ge(PG_FUNCTION_ARGS)
|
||||
{
|
||||
int cmp = range_cmp(fcinfo);
|
||||
|
||||
PG_RETURN_BOOL(cmp >= 0);
|
||||
}
|
||||
|
||||
@ -1070,6 +1114,7 @@ Datum
|
||||
range_gt(PG_FUNCTION_ARGS)
|
||||
{
|
||||
int cmp = range_cmp(fcinfo);
|
||||
|
||||
PG_RETURN_BOOL(cmp > 0);
|
||||
}
|
||||
|
||||
@ -1110,10 +1155,10 @@ hash_range(PG_FUNCTION_ARGS)
|
||||
subtype = rngtypinfo.subtype;
|
||||
|
||||
/*
|
||||
* We arrange to look up the hash function only once per series of
|
||||
* calls, assuming the subtype doesn't change underneath us. The
|
||||
* typcache is used so that we have no memory leakage when being
|
||||
* used as an index support function.
|
||||
* We arrange to look up the hash function only once per series of calls,
|
||||
* assuming the subtype doesn't change underneath us. The typcache is
|
||||
* used so that we have no memory leakage when being used as an index
|
||||
* support function.
|
||||
*/
|
||||
typentry = (TypeCacheEntry *) fcinfo->flinfo->fn_extra;
|
||||
if (typentry == NULL || typentry->type_id != subtype)
|
||||
@ -1128,8 +1173,8 @@ hash_range(PG_FUNCTION_ARGS)
|
||||
}
|
||||
|
||||
/*
|
||||
* Apply the hash function to each bound (the hash function shouldn't
|
||||
* care about the collation).
|
||||
* Apply the hash function to each bound (the hash function shouldn't care
|
||||
* about the collation).
|
||||
*/
|
||||
InitFunctionCallInfoData(locfcinfo, &typentry->hash_proc_finfo, 1,
|
||||
InvalidOid, NULL, NULL);
|
||||
@ -2066,8 +2111,8 @@ datum_compute_size(Size data_length, Datum val, bool typbyval, char typalign,
|
||||
VARATT_CAN_MAKE_SHORT(DatumGetPointer(val)))
|
||||
{
|
||||
/*
|
||||
* we're anticipating converting to a short varlena header, so
|
||||
* adjust length and don't count any alignment
|
||||
* we're anticipating converting to a short varlena header, so adjust
|
||||
* length and don't count any alignment
|
||||
*/
|
||||
data_length += VARATT_CONVERTED_SHORT_SIZE(DatumGetPointer(val));
|
||||
}
|
||||
|
@ -60,6 +60,7 @@ range_gist_consistent(PG_FUNCTION_ARGS)
|
||||
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
|
||||
Datum dquery = PG_GETARG_DATUM(1);
|
||||
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
|
||||
|
||||
/* Oid subtype = PG_GETARG_OID(3); */
|
||||
bool *recheck = (bool *) PG_GETARG_POINTER(4);
|
||||
RangeType *key = DatumGetRangeType(entry->key);
|
||||
@ -81,8 +82,8 @@ range_gist_consistent(PG_FUNCTION_ARGS)
|
||||
|
||||
/*
|
||||
* For contains and contained by operators, the other operand is a
|
||||
* "point" of the subtype. Construct a singleton range containing just
|
||||
* that value.
|
||||
* "point" of the subtype. Construct a singleton range containing
|
||||
* just that value.
|
||||
*/
|
||||
case RANGESTRAT_CONTAINS_ELEM:
|
||||
case RANGESTRAT_ELEM_CONTAINED_BY:
|
||||
@ -136,6 +137,7 @@ Datum
|
||||
range_gist_compress(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
|
||||
|
||||
PG_RETURN_POINTER(entry);
|
||||
}
|
||||
|
||||
@ -143,6 +145,7 @@ Datum
|
||||
range_gist_decompress(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
|
||||
|
||||
PG_RETURN_POINTER(entry);
|
||||
}
|
||||
|
||||
@ -158,11 +161,15 @@ range_gist_penalty(PG_FUNCTION_ARGS)
|
||||
|
||||
FmgrInfo *subtype_diff;
|
||||
|
||||
RangeBound lower1, lower2;
|
||||
RangeBound upper1, upper2;
|
||||
bool empty1, empty2;
|
||||
RangeBound lower1,
|
||||
lower2;
|
||||
RangeBound upper1,
|
||||
upper2;
|
||||
bool empty1,
|
||||
empty2;
|
||||
|
||||
float lower_diff, upper_diff;
|
||||
float lower_diff,
|
||||
upper_diff;
|
||||
|
||||
RangeTypeInfo rngtypinfo;
|
||||
|
||||
@ -331,9 +338,12 @@ range_gist_same(PG_FUNCTION_ARGS)
|
||||
static RangeType *
|
||||
range_super_union(FunctionCallInfo fcinfo, RangeType * r1, RangeType * r2)
|
||||
{
|
||||
RangeBound lower1, lower2;
|
||||
RangeBound upper1, upper2;
|
||||
bool empty1, empty2;
|
||||
RangeBound lower1,
|
||||
lower2;
|
||||
RangeBound upper1,
|
||||
upper2;
|
||||
bool empty1,
|
||||
empty2;
|
||||
RangeBound *result_lower;
|
||||
RangeBound *result_upper;
|
||||
|
||||
@ -371,9 +381,12 @@ range_gist_consistent_int(FunctionCallInfo fcinfo, StrategyNumber strategy,
|
||||
{
|
||||
Oid proc = InvalidOid;
|
||||
|
||||
RangeBound lower1, lower2;
|
||||
RangeBound upper1, upper2;
|
||||
bool empty1, empty2;
|
||||
RangeBound lower1,
|
||||
lower2;
|
||||
RangeBound upper1,
|
||||
upper2;
|
||||
bool empty1,
|
||||
empty2;
|
||||
|
||||
bool retval;
|
||||
bool negate = false;
|
||||
@ -451,9 +464,12 @@ range_gist_consistent_leaf(FunctionCallInfo fcinfo, StrategyNumber strategy,
|
||||
{
|
||||
Oid proc = InvalidOid;
|
||||
|
||||
RangeBound lower1, lower2;
|
||||
RangeBound upper1, upper2;
|
||||
bool empty1, empty2;
|
||||
RangeBound lower1,
|
||||
lower2;
|
||||
RangeBound upper1,
|
||||
upper2;
|
||||
bool empty1,
|
||||
empty2;
|
||||
|
||||
range_deserialize(fcinfo, key, &lower1, &upper1, &empty1);
|
||||
range_deserialize(fcinfo, query, &lower2, &upper2, &empty2);
|
||||
@ -530,9 +546,12 @@ sort_item_cmp(const void *a, const void *b)
|
||||
RangeType *r1 = i1->data;
|
||||
RangeType *r2 = i2->data;
|
||||
|
||||
RangeBound lower1, lower2;
|
||||
RangeBound upper1, upper2;
|
||||
bool empty1, empty2;
|
||||
RangeBound lower1,
|
||||
lower2;
|
||||
RangeBound upper1,
|
||||
upper2;
|
||||
bool empty1,
|
||||
empty2;
|
||||
|
||||
FunctionCallInfo fcinfo = i1->fcinfo;
|
||||
|
||||
@ -554,12 +573,11 @@ sort_item_cmp(const void *a, const void *b)
|
||||
}
|
||||
|
||||
/*
|
||||
* If both lower or both upper bounds are infinite, we sort by
|
||||
* ascending range size. That means that if both upper bounds are
|
||||
* infinite, we sort by the lower bound _descending_. That creates
|
||||
* a slightly odd total order, but keeps the pages with very
|
||||
* unselective predicates grouped more closely together on the
|
||||
* right.
|
||||
* If both lower or both upper bounds are infinite, we sort by ascending
|
||||
* range size. That means that if both upper bounds are infinite, we sort
|
||||
* by the lower bound _descending_. That creates a slightly odd total
|
||||
* order, but keeps the pages with very unselective predicates grouped
|
||||
* more closely together on the right.
|
||||
*/
|
||||
if (lower1.infinite || upper1.infinite ||
|
||||
lower2.infinite || upper2.infinite)
|
||||
|
Loading…
x
Reference in New Issue
Block a user