Commit cdaa45fd authored by Bruce Momjian's avatar Bruce Momjian

Run pgindent on range type files, per request from Tom.

parent 5b5985e6
......@@ -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 &&
......@@ -1158,7 +1159,7 @@ DefineEnum(CreateEnumStmt *stmt)
* Registers a new range type.
*/
void
DefineRange(CreateRangeStmt *stmt)
DefineRange(CreateRangeStmt * stmt)
{
char *typeName;
char *rangeArrayName;
......@@ -1432,7 +1433,7 @@ makeRangeConstructor(char *name, Oid namespace, Oid rangeOid, Oid subtype)
oidvector *constructorArgTypesVector;
ObjectAddress myself;
Oid procOid;
char *prosrc[4] = { "range_constructor0",
char *prosrc[4] = {"range_constructor0",
"range_constructor1",
"range_constructor2",
"range_constructor3"};
......@@ -2549,6 +2550,7 @@ validateDomainConstraint(Oid domainoid, char *ccbin)
FreeExecutorState(estate);
}
/*
* get_rels_with_domain
*
......
This diff is collapsed.
......@@ -33,14 +33,14 @@
#define RANGESTRAT_OVERRIGHT 11
#define RANGESTRAT_ADJACENT 12
static RangeType *range_super_union(FunctionCallInfo fcinfo, RangeType *r1,
RangeType *r2);
static RangeType *range_super_union(FunctionCallInfo fcinfo, RangeType * r1,
RangeType * r2);
static bool range_gist_consistent_int(FunctionCallInfo fcinfo,
StrategyNumber strategy, RangeType *key,
RangeType *query);
StrategyNumber strategy, RangeType * key,
RangeType * query);
static bool range_gist_consistent_leaf(FunctionCallInfo fcinfo,
StrategyNumber strategy, RangeType *key,
RangeType *query);
StrategyNumber strategy, RangeType * key,
RangeType * query);
static int sort_item_cmp(const void *a, const void *b);
/*
......@@ -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;
......@@ -329,11 +336,14 @@ range_gist_same(PG_FUNCTION_ARGS)
/* return the smallest range that contains r1 and r2 */
static RangeType *
range_super_union(FunctionCallInfo fcinfo, RangeType *r1, RangeType *r2)
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;
......@@ -367,13 +377,16 @@ range_super_union(FunctionCallInfo fcinfo, RangeType *r1, RangeType *r2)
static bool
range_gist_consistent_int(FunctionCallInfo fcinfo, StrategyNumber strategy,
RangeType *key, RangeType *query)
RangeType * key, RangeType * query)
{
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;
......@@ -447,13 +460,16 @@ range_gist_consistent_int(FunctionCallInfo fcinfo, StrategyNumber strategy,
static bool
range_gist_consistent_leaf(FunctionCallInfo fcinfo, StrategyNumber strategy,
RangeType *key, RangeType *query)
RangeType * key, RangeType * query)
{
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);
......@@ -525,14 +541,17 @@ range_gist_consistent_leaf(FunctionCallInfo fcinfo, StrategyNumber strategy,
static int
sort_item_cmp(const void *a, const void *b)
{
PickSplitSortItem *i1 = (PickSplitSortItem *)a;
PickSplitSortItem *i2 = (PickSplitSortItem *)b;
PickSplitSortItem *i1 = (PickSplitSortItem *) a;
PickSplitSortItem *i2 = (PickSplitSortItem *) 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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment