mirror of
https://github.com/postgres/postgres.git
synced 2025-07-12 21:01:52 +03:00
Refactor code creating PartitionBoundInfo
The code building PartitionBoundInfo based on the constituent partition data read from catalogs has been located in partcache.c, with a specific set of routines dedicated to bound types, like sorting or bound data creation. All this logic is moved to partbounds.c and relocates all the bound-specific logistic into it, with partition_bounds_create() as principal entry point. Author: Amit Langote Reviewed-by: Michael Paquier, Álvaro Herrera Discussion: https://postgr.es/m/3f289da8-6d10-75fe-814a-635e8b191d43@lab.ntt.co.jp
This commit is contained in:
@ -75,40 +75,14 @@ typedef struct PartitionBoundInfoData
|
||||
#define partition_bound_accepts_nulls(bi) ((bi)->null_index != -1)
|
||||
#define partition_bound_has_default(bi) ((bi)->default_index != -1)
|
||||
|
||||
/*
|
||||
* When qsort'ing partition bounds after reading from the catalog, each bound
|
||||
* is represented with one of the following structs.
|
||||
*/
|
||||
|
||||
/* One bound of a hash partition */
|
||||
typedef struct PartitionHashBound
|
||||
{
|
||||
int modulus;
|
||||
int remainder;
|
||||
int index;
|
||||
} PartitionHashBound;
|
||||
|
||||
/* One value coming from some (index'th) list partition */
|
||||
typedef struct PartitionListValue
|
||||
{
|
||||
int index;
|
||||
Datum value;
|
||||
} PartitionListValue;
|
||||
|
||||
/* One bound of a range partition */
|
||||
typedef struct PartitionRangeBound
|
||||
{
|
||||
int index;
|
||||
Datum *datums; /* range bound datums */
|
||||
PartitionRangeDatumKind *kind; /* the kind of each datum */
|
||||
bool lower; /* this is the lower (vs upper) bound */
|
||||
} PartitionRangeBound;
|
||||
|
||||
extern int get_hash_partition_greatest_modulus(PartitionBoundInfo b);
|
||||
extern uint64 compute_partition_hash_value(int partnatts, FmgrInfo *partsupfunc,
|
||||
Datum *values, bool *isnull);
|
||||
extern List *get_qual_from_partbound(Relation rel, Relation parent,
|
||||
PartitionBoundSpec *spec);
|
||||
extern PartitionBoundInfo partition_bounds_create(List *boundspecs,
|
||||
PartitionKey key,
|
||||
int **mapping);
|
||||
extern bool partition_bounds_equal(int partnatts, int16 *parttyplen,
|
||||
bool *parttypbyval, PartitionBoundInfo b1,
|
||||
PartitionBoundInfo b2);
|
||||
@ -120,14 +94,6 @@ extern void check_default_partition_contents(Relation parent,
|
||||
Relation defaultRel,
|
||||
PartitionBoundSpec *new_spec);
|
||||
|
||||
extern PartitionRangeBound *make_one_partition_rbound(PartitionKey key, int index,
|
||||
List *datums, bool lower);
|
||||
extern int32 partition_hbound_cmp(int modulus1, int remainder1, int modulus2,
|
||||
int remainder2);
|
||||
extern int32 partition_rbound_cmp(int partnatts, FmgrInfo *partsupfunc,
|
||||
Oid *partcollation, Datum *datums1,
|
||||
PartitionRangeDatumKind *kind1, bool lower1,
|
||||
PartitionRangeBound *b2);
|
||||
extern int32 partition_rbound_datum_cmp(FmgrInfo *partsupfunc,
|
||||
Oid *partcollation,
|
||||
Datum *rb_datums, PartitionRangeDatumKind *rb_kind,
|
||||
@ -136,10 +102,6 @@ extern int partition_list_bsearch(FmgrInfo *partsupfunc,
|
||||
Oid *partcollation,
|
||||
PartitionBoundInfo boundinfo,
|
||||
Datum value, bool *is_equal);
|
||||
extern int partition_range_bsearch(int partnatts, FmgrInfo *partsupfunc,
|
||||
Oid *partcollation,
|
||||
PartitionBoundInfo boundinfo,
|
||||
PartitionRangeBound *probe, bool *is_equal);
|
||||
extern int partition_range_datum_bsearch(FmgrInfo *partsupfunc,
|
||||
Oid *partcollation,
|
||||
PartitionBoundInfo boundinfo,
|
||||
|
Reference in New Issue
Block a user