MCPcopy Create free account
hub / github.com/apache/cloudberry / initPartEveryIterator

Function initPartEveryIterator

src/backend/parser/parse_partition_gp.c:515–750  ·  view source on GitHub ↗

* Functions for iterating through all the partition bounds based on * START/END/EVERY. */

Source from the content-addressed store, hash-verified

513 * START/END/EVERY.
514 */
515static PartEveryIterator *
516initPartEveryIterator(ParseState *pstate, PartitionKeyData *partkey, const char *part_col_name,
517 Node *start, bool startExclusive,
518 Node *end, bool endInclusive,
519 Node *every)
520{
521 PartEveryIterator *iter;
522 Datum startVal = 0;
523 Datum endVal = 0;
524 bool isEndValMaxValue = false;
525 Datum everyVal;
526 Oid plusop;
527 Oid part_col_typid;
528 int32 part_col_typmod;
529 Oid part_col_collation;
530
531 /* caller should've checked this already */
532 Assert(partkey->partnatts == 1);
533
534 part_col_typid = get_partition_col_typid(partkey, 0);
535 part_col_typmod = get_partition_col_typmod(partkey, 0);
536 part_col_collation = get_partition_col_collation(partkey, 0);
537
538 /* Parse the START/END/EVERY clauses */
539 if (start)
540 {
541 Const *startConst;
542
543 startConst = transformPartitionBoundValue(pstate,
544 start,
545 part_col_name,
546 part_col_typid,
547 part_col_typmod,
548 part_col_collation);
549 if (startConst->constisnull)
550 ereport(ERROR,
551 (errcode(ERRCODE_INVALID_TABLE_DEFINITION),
552 errmsg("cannot use NULL with range partition specification"),
553 parser_errposition(pstate, exprLocation(start))));
554
555 if (startExclusive)
556 convert_exclusive_start_inclusive_end(startConst,
557 part_col_typid, part_col_typmod,
558 true);
559 if (startConst->constisnull)
560 ereport(ERROR,
561 (errcode(ERRCODE_INVALID_TABLE_DEFINITION),
562 errmsg("START EXCLUSIVE is out of range"),
563 parser_errposition(pstate, exprLocation(start))));
564
565 startVal = startConst->constvalue;
566 }
567
568 if (end)
569 {
570 Const *endConst;
571 Node *expr = end;
572 PartitionRangeDatum *prd = NULL;

Callers 1

generateRangePartitionsFunction · 0.85

Calls 15

get_partition_col_typidFunction · 0.85
get_partition_col_typmodFunction · 0.85
parser_errpositionFunction · 0.85
exprLocationFunction · 0.85
list_lengthFunction · 0.85
make_opFunction · 0.85
makeStringFunction · 0.85
transformExprFunction · 0.85
exprCollationFunction · 0.85

Tested by

no test coverage detected