mirror of
https://github.com/postgres/postgres.git
synced 2025-09-03 15:22:11 +03:00
Refactor the way code is shared between some range type functions.
Functions like range_eq, range_before etc. are exposed at the SQL-level, but they're also used internally by the GiST consistent support function. The code sharing was done by a hack, TrickFunctionCall2, which relied on the knowledge that all the functions used fn_extra the same way. This commit splits the functions into internal versions that take a TypeCacheEntry as argument, and thin wrappers to expose the functions at the SQL-level. The internal versions can then be called directly and in a less hacky way from the GiST consistent function. This is just cosmetic, but backpatch to 9.2 anyway, to avoid having a different version of this code in the 9.2 branch. That would make backpatching fixes in this area more difficult. Alexander Korotkov
This commit is contained in:
@@ -104,6 +104,8 @@ extern Datum range_upper_inf(PG_FUNCTION_ARGS);
|
||||
extern Datum range_contains_elem(PG_FUNCTION_ARGS);
|
||||
extern Datum elem_contained_by_range(PG_FUNCTION_ARGS);
|
||||
|
||||
extern bool range_contains_elem_internal(TypeCacheEntry *typcache, RangeType *r, Datum val);
|
||||
|
||||
/* range, range -> bool */
|
||||
extern Datum range_eq(PG_FUNCTION_ARGS);
|
||||
extern Datum range_ne(PG_FUNCTION_ARGS);
|
||||
@@ -116,6 +118,28 @@ extern Datum range_overlaps(PG_FUNCTION_ARGS);
|
||||
extern Datum range_overleft(PG_FUNCTION_ARGS);
|
||||
extern Datum range_overright(PG_FUNCTION_ARGS);
|
||||
|
||||
/* internal versions of the above */
|
||||
extern bool range_eq_internal(TypeCacheEntry *typcache, RangeType *r1,
|
||||
RangeType *r2);
|
||||
extern bool range_ne_internal(TypeCacheEntry *typcache, RangeType *r1,
|
||||
RangeType *r2);
|
||||
extern bool range_contains_internal(TypeCacheEntry *typcache, RangeType *r1,
|
||||
RangeType *r2);
|
||||
extern bool range_contained_by_internal(TypeCacheEntry *typcache, RangeType *r1,
|
||||
RangeType *r2);
|
||||
extern bool range_before_internal(TypeCacheEntry *typcache, RangeType *r1,
|
||||
RangeType *r2);
|
||||
extern bool range_after_internal(TypeCacheEntry *typcache, RangeType *r1,
|
||||
RangeType *r2);
|
||||
extern bool range_adjacent_internal(TypeCacheEntry *typcache, RangeType *r1,
|
||||
RangeType *r2);
|
||||
extern bool range_overlaps_internal(TypeCacheEntry *typcache, RangeType *r1,
|
||||
RangeType *r2);
|
||||
extern bool range_overleft_internal(TypeCacheEntry *typcache, RangeType *r1,
|
||||
RangeType *r2);
|
||||
extern bool range_overright_internal(TypeCacheEntry *typcache, RangeType *r1,
|
||||
RangeType *r2);
|
||||
|
||||
/* range, range -> range */
|
||||
extern Datum range_minus(PG_FUNCTION_ARGS);
|
||||
extern Datum range_union(PG_FUNCTION_ARGS);
|
||||
|
Reference in New Issue
Block a user