PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/relation.h"
#include "access/table.h"
#include "access/tableam.h"
#include "catalog/partition.h"
#include "catalog/pg_inherits.h"
#include "catalog/pg_type.h"
#include "commands/tablecmds.h"
#include "common/hashfn.h"
#include "executor/executor.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
#include "nodes/nodeFuncs.h"
#include "nodes/pathnodes.h"
#include "parser/parse_coerce.h"
#include "partitioning/partbounds.h"
#include "partitioning/partdesc.h"
#include "utils/array.h"
#include "utils/builtins.h"
#include "utils/datum.h"
#include "utils/fmgroids.h"
#include "utils/lsyscache.h"
#include "utils/partcache.h"
#include "utils/ruleutils.h"
#include "utils/snapmgr.h"
#include "utils/syscache.h"
Go to the source code of this file.
Data Structures | |
struct | PartitionHashBound |
struct | PartitionListValue |
struct | PartitionRangeBound |
struct | PartitionMap |
Macros | |
#define | compare_range_bounds(partnatts, partsupfunc, partcollations, bound1, bound2) |
Typedefs | |
typedef struct PartitionHashBound | PartitionHashBound |
typedef struct PartitionListValue | PartitionListValue |
typedef struct PartitionRangeBound | PartitionRangeBound |
typedef struct PartitionMap | PartitionMap |
Functions | |
static int32 | qsort_partition_hbound_cmp (const void *a, const void *b) |
static int32 | qsort_partition_list_value_cmp (const void *a, const void *b, void *arg) |
static int32 | qsort_partition_rbound_cmp (const void *a, const void *b, void *arg) |
static PartitionBoundInfo | create_hash_bounds (PartitionBoundSpec **boundspecs, int nparts, PartitionKey key, int **mapping) |
static PartitionBoundInfo | create_list_bounds (PartitionBoundSpec **boundspecs, int nparts, PartitionKey key, int **mapping) |
static PartitionBoundInfo | create_range_bounds (PartitionBoundSpec **boundspecs, int nparts, PartitionKey key, int **mapping) |
static PartitionBoundInfo | merge_list_bounds (FmgrInfo *partsupfunc, Oid *partcollation, RelOptInfo *outer_rel, RelOptInfo *inner_rel, JoinType jointype, List **outer_parts, List **inner_parts) |
static PartitionBoundInfo | merge_range_bounds (int partnatts, FmgrInfo *partsupfuncs, Oid *partcollations, RelOptInfo *outer_rel, RelOptInfo *inner_rel, JoinType jointype, List **outer_parts, List **inner_parts) |
static void | init_partition_map (RelOptInfo *rel, PartitionMap *map) |
static void | free_partition_map (PartitionMap *map) |
static bool | is_dummy_partition (RelOptInfo *rel, int part_index) |
static int | merge_matching_partitions (PartitionMap *outer_map, PartitionMap *inner_map, int outer_index, int inner_index, int *next_index) |
static int | process_outer_partition (PartitionMap *outer_map, PartitionMap *inner_map, bool outer_has_default, bool inner_has_default, int outer_index, int inner_default, JoinType jointype, int *next_index, int *default_index) |
static int | process_inner_partition (PartitionMap *outer_map, PartitionMap *inner_map, bool outer_has_default, bool inner_has_default, int inner_index, int outer_default, JoinType jointype, int *next_index, int *default_index) |
static void | merge_null_partitions (PartitionMap *outer_map, PartitionMap *inner_map, bool outer_has_null, bool inner_has_null, int outer_null, int inner_null, JoinType jointype, int *next_index, int *null_index) |
static void | merge_default_partitions (PartitionMap *outer_map, PartitionMap *inner_map, bool outer_has_default, bool inner_has_default, int outer_default, int inner_default, JoinType jointype, int *next_index, int *default_index) |
static int | merge_partition_with_dummy (PartitionMap *map, int index, int *next_index) |
static void | fix_merged_indexes (PartitionMap *outer_map, PartitionMap *inner_map, int nmerged, List *merged_indexes) |
static void | generate_matching_part_pairs (RelOptInfo *outer_rel, RelOptInfo *inner_rel, PartitionMap *outer_map, PartitionMap *inner_map, int nmerged, List **outer_parts, List **inner_parts) |
static PartitionBoundInfo | build_merged_partition_bounds (char strategy, List *merged_datums, List *merged_kinds, List *merged_indexes, int null_index, int default_index) |
static int | get_range_partition (RelOptInfo *rel, PartitionBoundInfo bi, int *lb_pos, PartitionRangeBound *lb, PartitionRangeBound *ub) |
static int | get_range_partition_internal (PartitionBoundInfo bi, int *lb_pos, PartitionRangeBound *lb, PartitionRangeBound *ub) |
static bool | compare_range_partitions (int partnatts, FmgrInfo *partsupfuncs, Oid *partcollations, PartitionRangeBound *outer_lb, PartitionRangeBound *outer_ub, PartitionRangeBound *inner_lb, PartitionRangeBound *inner_ub, int *lb_cmpval, int *ub_cmpval) |
static void | get_merged_range_bounds (int partnatts, FmgrInfo *partsupfuncs, Oid *partcollations, JoinType jointype, PartitionRangeBound *outer_lb, PartitionRangeBound *outer_ub, PartitionRangeBound *inner_lb, PartitionRangeBound *inner_ub, int lb_cmpval, int ub_cmpval, PartitionRangeBound *merged_lb, PartitionRangeBound *merged_ub) |
static void | add_merged_range_bounds (int partnatts, FmgrInfo *partsupfuncs, Oid *partcollations, PartitionRangeBound *merged_lb, PartitionRangeBound *merged_ub, int merged_index, List **merged_datums, List **merged_kinds, List **merged_indexes) |
static PartitionRangeBound * | make_one_partition_rbound (PartitionKey key, int index, List *datums, bool lower) |
static int32 | partition_hbound_cmp (int modulus1, int remainder1, int modulus2, int remainder2) |
static int32 | partition_rbound_cmp (int partnatts, FmgrInfo *partsupfunc, Oid *partcollation, Datum *datums1, PartitionRangeDatumKind *kind1, bool lower1, PartitionRangeBound *b2) |
static int | partition_range_bsearch (int partnatts, FmgrInfo *partsupfunc, Oid *partcollation, PartitionBoundInfo boundinfo, PartitionRangeBound *probe, int32 *cmpval) |
static Expr * | make_partition_op_expr (PartitionKey key, int keynum, uint16 strategy, Expr *arg1, Expr *arg2) |
static Oid | get_partition_operator (PartitionKey key, int col, StrategyNumber strategy, bool *need_relabel) |
static List * | get_qual_for_hash (Relation parent, PartitionBoundSpec *spec) |
static List * | get_qual_for_list (Relation parent, PartitionBoundSpec *spec) |
static List * | get_qual_for_range (Relation parent, PartitionBoundSpec *spec, bool for_default) |
static void | get_range_key_properties (PartitionKey key, int keynum, PartitionRangeDatum *ldatum, PartitionRangeDatum *udatum, ListCell **partexprs_item, Expr **keyCol, Const **lower_val, Const **upper_val) |
static List * | get_range_nulltest (PartitionKey key) |
List * | get_qual_from_partbound (Relation parent, PartitionBoundSpec *spec) |
PartitionBoundInfo | partition_bounds_create (PartitionBoundSpec **boundspecs, int nparts, PartitionKey key, int **mapping) |
static int | get_non_null_list_datum_count (PartitionBoundSpec **boundspecs, int nparts) |
bool | partition_bounds_equal (int partnatts, int16 *parttyplen, bool *parttypbyval, PartitionBoundInfo b1, PartitionBoundInfo b2) |
PartitionBoundInfo | partition_bounds_copy (PartitionBoundInfo src, PartitionKey key) |
PartitionBoundInfo | partition_bounds_merge (int partnatts, FmgrInfo *partsupfunc, Oid *partcollation, RelOptInfo *outer_rel, RelOptInfo *inner_rel, JoinType jointype, List **outer_parts, List **inner_parts) |
bool | partitions_are_ordered (PartitionBoundInfo boundinfo, Bitmapset *live_parts) |
void | check_new_partition_bound (char *relname, Relation parent, PartitionBoundSpec *spec, ParseState *pstate) |
void | check_default_partition_contents (Relation parent, Relation default_rel, PartitionBoundSpec *new_spec) |
int | get_hash_partition_greatest_modulus (PartitionBoundInfo bound) |
int32 | partition_rbound_datum_cmp (FmgrInfo *partsupfunc, Oid *partcollation, Datum *rb_datums, PartitionRangeDatumKind *rb_kind, Datum *tuple_datums, int n_tuple_datums) |
int | partition_list_bsearch (FmgrInfo *partsupfunc, Oid *partcollation, PartitionBoundInfo boundinfo, Datum value, bool *is_equal) |
int | partition_range_datum_bsearch (FmgrInfo *partsupfunc, Oid *partcollation, PartitionBoundInfo boundinfo, int nvalues, Datum *values, bool *is_equal) |
int | partition_hash_bsearch (PartitionBoundInfo boundinfo, int modulus, int remainder) |
uint64 | compute_partition_hash_value (int partnatts, FmgrInfo *partsupfunc, const Oid *partcollation, const Datum *values, const bool *isnull) |
Datum | satisfies_hash_partition (PG_FUNCTION_ARGS) |
#define compare_range_bounds | ( | partnatts, | |
partsupfunc, | |||
partcollations, | |||
bound1, | |||
bound2 | |||
) |
Definition at line 88 of file partbounds.c.
typedef struct PartitionHashBound PartitionHashBound |
typedef struct PartitionListValue PartitionListValue |
typedef struct PartitionMap PartitionMap |
typedef struct PartitionRangeBound PartitionRangeBound |
|
static |
Definition at line 2775 of file partbounds.c.
References Assert, PartitionRangeBound::datums, PartitionRangeBound::index, PartitionRangeBound::kind, lappend(), lappend_int(), llast, llast_int, PartitionRangeBound::lower, and partition_rbound_cmp().
Referenced by merge_range_bounds().
|
static |
Definition at line 2518 of file partbounds.c.
References Assert, PartitionBoundInfoData::datums, PartitionBoundInfoData::default_index, PartitionBoundInfoData::indexes, PartitionBoundInfoData::interleaved_parts, PartitionBoundInfoData::kind, lappend_int(), lfirst, lfirst_int, list_length(), PartitionBoundInfoData::ndatums, NIL, PartitionBoundInfoData::nindexes, PartitionBoundInfoData::null_index, palloc(), PARTITION_STRATEGY_LIST, PARTITION_STRATEGY_RANGE, and PartitionBoundInfoData::strategy.
Referenced by merge_list_bounds(), and merge_range_bounds().
void check_default_partition_contents | ( | Relation | parent, |
Relation | default_rel, | ||
PartitionBoundSpec * | new_spec | ||
) |
Definition at line 3251 of file partbounds.c.
References AccessExclusiveLock, CHECK_FOR_INTERRUPTS, CreateExecutorState(), DEBUG1, ExprContext::ecxt_scantuple, ereport, errcode(), errmsg(), errmsg_internal(), ERROR, errtable(), EState::es_tupleTable, ExecCheck(), ExecDropSingleTupleTableSlot(), ExecPrepareExpr(), find_all_inheritors(), ForwardScanDirection, FreeExecutorState(), get_proposed_default_constraint(), get_qual_for_list(), get_qual_for_range(), GetLatestSnapshot(), GetPerTupleExprContext, GetPerTupleMemoryContext, lfirst_oid, list_make1_oid, make_ands_explicit(), map_partition_varattnos(), MemoryContextSwitchTo(), NoLock, PartConstraintImpliedByRelConstraint(), PARTITION_STRATEGY_LIST, RelationData::rd_rel, RegisterSnapshot(), RelationGetRelationName, RelationGetRelid, ResetExprContext, PartitionBoundSpec::strategy, table_beginscan(), table_close(), table_endscan(), table_open(), table_scan_getnextslot(), table_slot_create(), UnregisterSnapshot(), and WARNING.
Referenced by DefineRelation().
void check_new_partition_bound | ( | char * | relname, |
Relation | parent, | ||
PartitionBoundSpec * | spec, | ||
ParseState * | pstate | ||
) |
Definition at line 2896 of file partbounds.c.
References Assert, PartitionDescData::boundinfo, DatumGetInt32(), PartitionBoundInfoData::datums, PartitionBoundInfoData::default_index, equal(), ereport, errcode(), errdetail(), errmsg(), ERROR, get_range_partbound_string(), get_rel_name(), PartitionBoundInfoData::indexes, PartitionBoundSpec::is_default, sort-test::key, PartitionBoundInfoData::kind, lfirst_node, linitial, list_nth(), PartitionBoundSpec::listdatums, PartitionBoundSpec::location, PartitionRangeDatum::location, lower(), PartitionBoundSpec::lowerdatums, make_one_partition_rbound(), PartitionBoundSpec::modulus, PartitionBoundInfoData::ndatums, PartitionBoundInfoData::nindexes, PartitionDescData::nparts, PartitionBoundInfoData::null_index, PartitionDescData::oids, parser_errposition(), partition_bound_accepts_nulls, partition_bound_has_default, partition_hash_bsearch(), partition_list_bsearch(), partition_range_bsearch(), partition_rbound_cmp(), PARTITION_STRATEGY_HASH, PARTITION_STRATEGY_LIST, PARTITION_STRATEGY_RANGE, RelationGetPartitionDesc(), RelationGetPartitionKey(), relname, PartitionBoundSpec::remainder, PartitionBoundSpec::strategy, PartitionBoundInfoData::strategy, upper(), PartitionBoundSpec::upperdatums, and val.
Referenced by ATExecAttachPartition(), and DefineRelation().
|
static |
Definition at line 2662 of file partbounds.c.
References compare_range_bounds.
Referenced by merge_range_bounds().
uint64 compute_partition_hash_value | ( | int | partnatts, |
FmgrInfo * | partsupfunc, | ||
const Oid * | partcollation, | ||
const Datum * | values, | ||
const bool * | isnull | ||
) |
Definition at line 4722 of file partbounds.c.
References Assert, DatumGetUInt64(), FunctionCall2Coll(), hash(), hash_combine64(), HASH_PARTITION_SEED, i, OidIsValid, UInt64GetDatum(), and values.
Referenced by get_matching_hash_bounds(), and get_partition_for_tuple().
|
static |
Definition at line 347 of file partbounds.c.
References Assert, PartitionBoundInfoData::datums, PartitionBoundInfoData::default_index, elog, ERROR, i, PartitionHashBound::index, PartitionBoundInfoData::indexes, Int32GetDatum(), PartitionBoundInfoData::interleaved_parts, sort-test::key, PartitionBoundInfoData::kind, PartitionHashBound::modulus, PartitionBoundSpec::modulus, PartitionBoundInfoData::ndatums, PartitionBoundInfoData::nindexes, PartitionBoundInfoData::null_index, palloc(), palloc0(), PARTITION_STRATEGY_HASH, pfree(), qsort, qsort_partition_hbound_cmp(), PartitionHashBound::remainder, PartitionBoundSpec::remainder, PartitionBoundSpec::strategy, and PartitionBoundInfoData::strategy.
Referenced by partition_bounds_create().
|
static |
Definition at line 462 of file partbounds.c.
References Assert, bms_add_member(), datumCopy(), PartitionBoundInfoData::datums, PartitionBoundInfoData::default_index, elog, ERROR, get_non_null_list_datum_count(), i, PartitionListValue::index, PartitionBoundInfoData::indexes, PartitionBoundInfoData::interleaved_parts, PartitionBoundSpec::is_default, j, sort-test::key, PartitionBoundInfoData::kind, lfirst_node, PartitionBoundSpec::listdatums, PartitionBoundInfoData::ndatums, PartitionBoundInfoData::nindexes, PartitionBoundInfoData::null_index, palloc(), palloc0(), partition_bound_accepts_nulls, partition_bound_has_default, PARTITION_STRATEGY_LIST, pfree(), qsort_arg(), qsort_partition_list_value_cmp(), PartitionBoundSpec::strategy, PartitionBoundInfoData::strategy, val, PartitionListValue::value, and value.
Referenced by partition_bounds_create().
|
static |
Definition at line 677 of file partbounds.c.
References Assert, cur, datumCopy(), DatumGetInt32(), PartitionRangeBound::datums, PartitionBoundInfoData::datums, PartitionBoundInfoData::default_index, elog, ERROR, FunctionCall2Coll(), i, PartitionRangeBound::index, PartitionBoundInfoData::indexes, PartitionBoundInfoData::interleaved_parts, PartitionBoundSpec::is_default, j, sort-test::key, PartitionRangeBound::kind, PartitionBoundInfoData::kind, lower(), PartitionBoundSpec::lowerdatums, make_one_partition_rbound(), PartitionBoundInfoData::ndatums, PartitionBoundInfoData::nindexes, PartitionBoundInfoData::null_index, palloc(), palloc0(), PARTITION_RANGE_DATUM_VALUE, PARTITION_STRATEGY_RANGE, pfree(), qsort_arg(), qsort_partition_rbound_cmp(), PartitionBoundSpec::strategy, PartitionBoundInfoData::strategy, upper(), and PartitionBoundSpec::upperdatums.
Referenced by partition_bounds_create().
|
static |
Definition at line 2385 of file partbounds.c.
References Assert, PartitionMap::did_remapping, i, lfirst_int, PartitionMap::merged_indexes, PartitionMap::nparts, PartitionMap::old_indexes, palloc(), and pfree().
Referenced by merge_list_bounds().
|
static |
Definition at line 1832 of file partbounds.c.
References PartitionMap::merged, PartitionMap::merged_indexes, PartitionMap::old_indexes, and pfree().
Referenced by merge_list_bounds(), and merge_range_bounds().
|
static |
Definition at line 2439 of file partbounds.c.
References Assert, i, lappend(), Max, PartitionMap::merged_indexes, NIL, PartitionMap::nparts, RelOptInfo::nparts, palloc(), and pfree().
Referenced by merge_list_bounds(), and merge_range_bounds().
int get_hash_partition_greatest_modulus | ( | PartitionBoundInfo | bound | ) |
Definition at line 3414 of file partbounds.c.
References Assert, PartitionBoundInfoData::nindexes, PARTITION_STRATEGY_HASH, and PartitionBoundInfoData::strategy.
|
static |
Definition at line 2711 of file partbounds.c.
References Assert, compare_range_bounds, elog, ERROR, JOIN_ANTI, JOIN_FULL, JOIN_INNER, JOIN_LEFT, and JOIN_SEMI.
Referenced by merge_range_bounds().
|
static |
Definition at line 436 of file partbounds.c.
References i, lfirst_node, and val.
Referenced by create_list_bounds().
|
static |
Definition at line 3832 of file partbounds.c.
References elog, ERROR, get_opfamily_member(), sort-test::key, and OidIsValid.
Referenced by make_partition_op_expr().
|
static |
Definition at line 3983 of file partbounds.c.
References generate_unaccent_rules::args, COERCE_EXPLICIT_CALL, copyObject, i, Int32GetDatum(), InvalidOid, sort-test::key, lappend(), lfirst, list_head(), list_make1, list_make3, lnext(), makeConst(), makeFuncExpr(), makeVar(), PartitionBoundSpec::modulus, ObjectIdGetDatum(), RelationGetPartitionKey(), RelationGetRelid, and PartitionBoundSpec::remainder.
Referenced by get_qual_from_partbound().
|
static |
Definition at line 4066 of file partbounds.c.
References NullTest::arg, Assert, PartitionDescData::boundinfo, BTEqualStrategyNumber, copyObject, datumCopy(), PartitionBoundInfoData::datums, i, PartitionBoundSpec::is_default, IS_NOT_NULL, IS_NULL, sort-test::key, lappend(), lfirst_node, linitial, list_make1, list_make2, PartitionBoundSpec::listdatums, NullTest::location, make_ands_explicit(), make_partition_op_expr(), makeBoolExpr(), makeConst(), makeNode, makeVar(), PartitionBoundInfoData::ndatums, NIL, NOT_EXPR, NullTest::nulltesttype, OR_EXPR, partition_bound_accepts_nulls, RelationGetPartitionDesc(), RelationGetPartitionKey(), and val.
Referenced by check_default_partition_contents(), and get_qual_from_partbound().
|
static |
Definition at line 4275 of file partbounds.c.
References AND_EXPR, BTEqualStrategyNumber, BTGreaterEqualStrategyNumber, BTGreaterStrategyNumber, BTLessEqualStrategyNumber, BTLessStrategyNumber, castNode, CreateExecutorState(), DatumGetBool(), elog, ERROR, EState::es_query_cxt, ExecEvalExprSwitchContext(), ExecInitExpr(), fix_opfuncids(), for_both_cell, forboth, FreeExecutorState(), get_range_key_properties(), get_range_nulltest(), GetPerTupleExprContext, HeapTupleIsValid, i, PartitionBoundSpec::is_default, IsA, j, sort-test::key, PartitionRangeDatum::kind, lappend(), lfirst, lfirst_node, linitial, list_head(), list_length(), list_make1, lnext(), PartitionBoundSpec::lowerdatums, make_partition_op_expr(), makeBoolConst(), makeBoolExpr(), MemoryContextSwitchTo(), NIL, NOT_EXPR, PartitionDescData::nparts, ObjectIdGetDatum(), PartitionDescData::oids, OR_EXPR, PARTITION_RANGE_DATUM_MAXVALUE, PARTITION_RANGE_DATUM_MINVALUE, PARTITION_RANGE_DATUM_VALUE, RelationGetPartitionDesc(), RelationGetPartitionKey(), ReleaseSysCache(), SearchSysCache1(), stringToNode(), SysCacheGetAttrNotNull(), TextDatumGetCString, and PartitionBoundSpec::upperdatums.
Referenced by check_default_partition_contents(), and get_qual_from_partbound().
List* get_qual_from_partbound | ( | Relation | parent, |
PartitionBoundSpec * | spec | ||
) |
Definition at line 249 of file partbounds.c.
References Assert, get_qual_for_hash(), get_qual_for_list(), get_qual_for_range(), sort-test::key, NIL, PARTITION_STRATEGY_HASH, PARTITION_STRATEGY_LIST, PARTITION_STRATEGY_RANGE, RelationGetPartitionKey(), and PartitionBoundSpec::strategy.
Referenced by ATExecAttachPartition(), and generate_partition_qual().
|
static |
Definition at line 4632 of file partbounds.c.
References castNode, copyObject, elog, ERROR, sort-test::key, PartitionRangeDatum::kind, lfirst, lnext(), makeVar(), PARTITION_RANGE_DATUM_VALUE, and PartitionRangeDatum::value.
Referenced by get_qual_for_range().
|
static |
Definition at line 4676 of file partbounds.c.
References NullTest::arg, copyObject, elog, ERROR, i, IS_NOT_NULL, sort-test::key, lappend(), lfirst, list_head(), lnext(), NullTest::location, makeNode, makeVar(), NIL, and NullTest::nulltesttype.
Referenced by get_qual_for_range().
|
static |
Definition at line 2581 of file partbounds.c.
References Assert, get_range_partition_internal(), is_dummy_partition(), PARTITION_STRATEGY_RANGE, and PartitionBoundInfoData::strategy.
Referenced by merge_range_bounds().
|
static |
Definition at line 2602 of file partbounds.c.
References Assert, PartitionRangeBound::datums, PartitionBoundInfoData::datums, PartitionRangeBound::index, PartitionBoundInfoData::indexes, PartitionRangeBound::kind, PartitionBoundInfoData::kind, PartitionRangeBound::lower, and PartitionBoundInfoData::ndatums.
Referenced by get_range_partition().
|
static |
Definition at line 1811 of file partbounds.c.
References PartitionMap::did_remapping, i, PartitionMap::merged, PartitionMap::merged_indexes, PartitionMap::nparts, RelOptInfo::nparts, PartitionMap::old_indexes, and palloc().
Referenced by merge_list_bounds(), and merge_range_bounds().
|
static |
Definition at line 1843 of file partbounds.c.
References Assert, and IS_DUMMY_REL.
Referenced by get_range_partition(), merge_list_bounds(), and merge_range_bounds().
|
static |
Definition at line 3428 of file partbounds.c.
References Assert, castNode, PartitionRangeBound::datums, elog, ERROR, i, PartitionRangeBound::index, sort-test::key, PartitionRangeBound::kind, PartitionRangeDatum::kind, lfirst_node, PartitionRangeBound::lower, lower(), NIL, palloc0(), PARTITION_RANGE_DATUM_VALUE, val, and PartitionRangeDatum::value.
Referenced by check_new_partition_bound(), and create_range_bounds().
|
static |
Definition at line 3868 of file partbounds.c.
References ScalarArrayOpExpr::args, Assert, COERCE_EXPLICIT_CAST, ArrayExpr::elements, get_array_type(), get_opcode(), get_partition_operator(), InvalidOid, IsA, sort-test::key, lappend(), lfirst, linitial, list_length(), list_make2, ScalarArrayOpExpr::location, ArrayExpr::location, make_opclause(), makeBoolExpr(), makeNode, makeRelabelType(), NIL, ScalarArrayOpExpr::opno, OR_EXPR, PARTITION_STRATEGY_HASH, PARTITION_STRATEGY_LIST, PARTITION_STRATEGY_RANGE, type_is_array, and ScalarArrayOpExpr::useOr.
Referenced by get_qual_for_list(), and get_qual_for_range().
|
static |
Definition at line 2257 of file partbounds.c.
References Assert, IS_OUTER_JOIN, JOIN_FULL, JOIN_RIGHT, merge_matching_partitions(), merge_partition_with_dummy(), and PartitionMap::merged_indexes.
Referenced by merge_list_bounds(), and merge_range_bounds().
|
static |
Definition at line 1198 of file partbounds.c.
References Assert, build_merged_partition_bounds(), cleanup(), DatumGetInt32(), PartitionBoundInfoData::datums, PartitionBoundInfoData::default_index, PartitionMap::did_remapping, fix_merged_indexes(), free_partition_map(), FunctionCall2Coll(), generate_matching_part_pairs(), PartitionBoundInfoData::indexes, init_partition_map(), is_dummy_partition(), IS_OUTER_JOIN, JOIN_FULL, PartitionBoundInfoData::kind, lappend(), lappend_int(), list_free(), list_length(), merge_default_partitions(), merge_matching_partitions(), merge_null_partitions(), PartitionBoundInfoData::ndatums, NIL, PartitionBoundInfoData::null_index, partition_bound_accepts_nulls, partition_bound_has_default, PARTITION_STRATEGY_LIST, process_inner_partition(), process_outer_partition(), and PartitionBoundInfoData::strategy.
Referenced by partition_bounds_merge().
|
static |
Definition at line 1862 of file partbounds.c.
References Assert, PartitionMap::did_remapping, PartitionMap::merged, PartitionMap::merged_indexes, and PartitionMap::old_indexes.
Referenced by merge_default_partitions(), merge_list_bounds(), merge_null_partitions(), merge_range_bounds(), process_inner_partition(), and process_outer_partition().
|
static |
Definition at line 2147 of file partbounds.c.
References Assert, IS_OUTER_JOIN, JOIN_FULL, JOIN_RIGHT, merge_matching_partitions(), merge_partition_with_dummy(), and PartitionMap::merged_indexes.
Referenced by merge_list_bounds().
|
static |
Definition at line 2367 of file partbounds.c.
References Assert, PartitionMap::merged, and PartitionMap::merged_indexes.
Referenced by merge_default_partitions(), merge_null_partitions(), process_inner_partition(), and process_outer_partition().
|
static |
Definition at line 1506 of file partbounds.c.
References add_merged_range_bounds(), Assert, build_merged_partition_bounds(), cleanup(), compare_range_bounds, compare_range_partitions(), PartitionBoundInfoData::default_index, PartitionMap::did_remapping, free_partition_map(), generate_matching_part_pairs(), get_merged_range_bounds(), get_range_partition(), init_partition_map(), is_dummy_partition(), IS_OUTER_JOIN, JOIN_FULL, list_free(), list_length(), merge_default_partitions(), merge_matching_partitions(), PartitionMap::merged, PartitionMap::merged_indexes, NIL, partition_bound_has_default, PARTITION_STRATEGY_RANGE, process_inner_partition(), process_outer_partition(), and PartitionBoundInfoData::strategy.
Referenced by partition_bounds_merge().
PartitionBoundInfo partition_bounds_copy | ( | PartitionBoundInfo | src, |
PartitionKey | key | ||
) |
Definition at line 1002 of file partbounds.c.
References Assert, bms_copy(), datumCopy(), PartitionBoundInfoData::datums, PartitionBoundInfoData::default_index, generate_unaccent_rules::dest, i, PartitionBoundInfoData::indexes, PartitionBoundInfoData::interleaved_parts, j, sort-test::key, PartitionBoundInfoData::kind, PartitionBoundInfoData::ndatums, PartitionBoundInfoData::nindexes, PartitionBoundInfoData::null_index, palloc(), PARTITION_RANGE_DATUM_VALUE, PARTITION_STRATEGY_HASH, PARTITION_STRATEGY_LIST, PARTITION_STRATEGY_RANGE, and PartitionBoundInfoData::strategy.
Referenced by RelationBuildPartitionDesc().
PartitionBoundInfo partition_bounds_create | ( | PartitionBoundSpec ** | boundspecs, |
int | nparts, | ||
PartitionKey | key, | ||
int ** | mapping | ||
) |
Definition at line 299 of file partbounds.c.
References Assert, create_hash_bounds(), create_list_bounds(), create_range_bounds(), i, sort-test::key, palloc(), PARTITION_STRATEGY_HASH, PARTITION_STRATEGY_LIST, and PARTITION_STRATEGY_RANGE.
Referenced by RelationBuildPartitionDesc().
bool partition_bounds_equal | ( | int | partnatts, |
int16 * | parttyplen, | ||
bool * | parttypbyval, | ||
PartitionBoundInfo | b1, | ||
PartitionBoundInfo | b2 | ||
) |
Definition at line 896 of file partbounds.c.
References Assert, datumIsEqual(), PartitionBoundInfoData::datums, PartitionBoundInfoData::default_index, i, PartitionBoundInfoData::indexes, j, PartitionBoundInfoData::kind, PartitionBoundInfoData::ndatums, PartitionBoundInfoData::nindexes, PartitionBoundInfoData::null_index, PARTITION_RANGE_DATUM_VALUE, PARTITION_STRATEGY_HASH, and PartitionBoundInfoData::strategy.
Referenced by compute_partition_bounds().
PartitionBoundInfo partition_bounds_merge | ( | int | partnatts, |
FmgrInfo * | partsupfunc, | ||
Oid * | partcollation, | ||
RelOptInfo * | outer_rel, | ||
RelOptInfo * | inner_rel, | ||
JoinType | jointype, | ||
List ** | outer_parts, | ||
List ** | inner_parts | ||
) |
Definition at line 1118 of file partbounds.c.
References Assert, JOIN_ANTI, JOIN_FULL, JOIN_INNER, JOIN_LEFT, JOIN_SEMI, merge_list_bounds(), merge_range_bounds(), NIL, PARTITION_STRATEGY_HASH, PARTITION_STRATEGY_LIST, and PARTITION_STRATEGY_RANGE.
Referenced by compute_partition_bounds().
int partition_hash_bsearch | ( | PartitionBoundInfo | boundinfo, |
int | modulus, | ||
int | remainder | ||
) |
Definition at line 3738 of file partbounds.c.
References DatumGetInt32(), PartitionBoundInfoData::datums, PartitionBoundInfoData::ndatums, and partition_hbound_cmp().
Referenced by check_new_partition_bound().
|
static |
Definition at line 3587 of file partbounds.c.
Referenced by partition_hash_bsearch(), and qsort_partition_hbound_cmp().
int partition_list_bsearch | ( | FmgrInfo * | partsupfunc, |
Oid * | partcollation, | ||
PartitionBoundInfo | boundinfo, | ||
Datum | value, | ||
bool * | is_equal | ||
) |
Definition at line 3607 of file partbounds.c.
References DatumGetInt32(), PartitionBoundInfoData::datums, FunctionCall2Coll(), PartitionBoundInfoData::ndatums, and value.
Referenced by check_new_partition_bound(), get_matching_list_bounds(), and get_partition_for_tuple().
|
static |
Definition at line 3653 of file partbounds.c.
References PartitionBoundInfoData::datums, PartitionBoundInfoData::indexes, PartitionBoundInfoData::kind, PartitionBoundInfoData::ndatums, and partition_rbound_cmp().
Referenced by check_new_partition_bound().
int partition_range_datum_bsearch | ( | FmgrInfo * | partsupfunc, |
Oid * | partcollation, | ||
PartitionBoundInfo | boundinfo, | ||
int | nvalues, | ||
Datum * | values, | ||
bool * | is_equal | ||
) |
Definition at line 3695 of file partbounds.c.
References PartitionBoundInfoData::datums, PartitionBoundInfoData::kind, PartitionBoundInfoData::ndatums, partition_rbound_datum_cmp(), and values.
Referenced by get_matching_range_bounds(), and get_partition_for_tuple().
|
static |
Definition at line 3488 of file partbounds.c.
References DatumGetInt32(), PartitionRangeBound::datums, FunctionCall2Coll(), i, PartitionRangeBound::kind, PartitionRangeBound::lower, and PARTITION_RANGE_DATUM_VALUE.
Referenced by add_merged_range_bounds(), check_new_partition_bound(), and partition_range_bsearch().
int32 partition_rbound_datum_cmp | ( | FmgrInfo * | partsupfunc, |
Oid * | partcollation, | ||
Datum * | rb_datums, | ||
PartitionRangeDatumKind * | rb_kind, | ||
Datum * | tuple_datums, | ||
int | n_tuple_datums | ||
) |
Definition at line 3556 of file partbounds.c.
References DatumGetInt32(), FunctionCall2Coll(), i, PARTITION_RANGE_DATUM_MAXVALUE, and PARTITION_RANGE_DATUM_MINVALUE.
Referenced by get_matching_range_bounds(), get_partition_for_tuple(), and partition_range_datum_bsearch().
bool partitions_are_ordered | ( | PartitionBoundInfo | boundinfo, |
Bitmapset * | live_parts | ||
) |
Definition at line 2852 of file partbounds.c.
References Assert, bms_is_member(), bms_overlap(), PartitionBoundInfoData::default_index, PartitionBoundInfoData::interleaved_parts, partition_bound_has_default, PARTITION_STRATEGY_HASH, PARTITION_STRATEGY_LIST, PARTITION_STRATEGY_RANGE, and PartitionBoundInfoData::strategy.
Referenced by build_partition_pathkeys(), and generate_orderedappend_paths().
|
static |
Definition at line 2062 of file partbounds.c.
References Assert, IS_OUTER_JOIN, JOIN_FULL, JOIN_RIGHT, merge_matching_partitions(), merge_partition_with_dummy(), and PartitionMap::merged_indexes.
Referenced by merge_list_bounds(), and merge_range_bounds().
|
static |
Definition at line 1980 of file partbounds.c.
References Assert, IS_OUTER_JOIN, JOIN_FULL, JOIN_RIGHT, merge_matching_partitions(), merge_partition_with_dummy(), and PartitionMap::merged_indexes.
Referenced by merge_list_bounds(), and merge_range_bounds().
|
static |
Definition at line 3778 of file partbounds.c.
References a, b, PartitionHashBound::modulus, partition_hbound_cmp(), and PartitionHashBound::remainder.
Referenced by create_hash_bounds().
|
static |
Definition at line 3793 of file partbounds.c.
References a, arg, b, DatumGetInt32(), FunctionCall2Coll(), and sort-test::key.
Referenced by create_list_bounds().
|
static |
Definition at line 3810 of file partbounds.c.
References a, arg, b, compare_range_bounds, and sort-test::key.
Referenced by create_range_bounds().
Datum satisfies_hash_partition | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4771 of file partbounds.c.
References AccessShareLock, ARR_ELEMTYPE, DatumGetUInt64(), deconstruct_array(), ereport, errcode(), errmsg(), ERROR, FLEXIBLE_ARRAY_MEMBER, fmgr_info_copy(), format_type_be(), FunctionCall2Coll(), get_fn_expr_argtype(), get_fn_expr_variadic(), get_rel_name(), get_typlenbyvalalign(), hash(), hash_combine64(), HASH_PARTITION_SEED, i, if(), IsBinaryCoercible(), j, sort-test::key, MemoryContextAllocZero(), NoLock, OidIsValid, PARTITION_MAX_KEYS, PARTITION_STRATEGY_HASH, PG_ARGISNULL, PG_GETARG_ARRAYTYPE_P, PG_GETARG_DATUM, PG_GETARG_INT32, PG_GETARG_OID, PG_NARGS, PG_RETURN_BOOL, relation_close(), relation_open(), RelationGetPartitionKey(), and UInt64GetDatum().