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

Function validateInfiniteBounds

src/backend/parser/parse_utilcmd.c:5487–5521  ·  view source on GitHub ↗

* validateInfiniteBounds * * Check that a MAXVALUE or MINVALUE specification in a partition bound is * followed only by more of the same. */

Source from the content-addressed store, hash-verified

5485 * followed only by more of the same.
5486 */
5487static void
5488validateInfiniteBounds(ParseState *pstate, List *blist)
5489{
5490 ListCell *lc;
5491 PartitionRangeDatumKind kind = PARTITION_RANGE_DATUM_VALUE;
5492
5493 foreach(lc, blist)
5494 {
5495 PartitionRangeDatum *prd = castNode(PartitionRangeDatum, lfirst(lc));
5496
5497 if (kind == prd->kind)
5498 continue;
5499
5500 switch (kind)
5501 {
5502 case PARTITION_RANGE_DATUM_VALUE:
5503 kind = prd->kind;
5504 break;
5505
5506 case PARTITION_RANGE_DATUM_MAXVALUE:
5507 ereport(ERROR,
5508 (errcode(ERRCODE_DATATYPE_MISMATCH),
5509 errmsg("every bound following MAXVALUE must also be MAXVALUE"),
5510 parser_errposition(pstate, exprLocation((Node *) prd))));
5511 break;
5512
5513 case PARTITION_RANGE_DATUM_MINVALUE:
5514 ereport(ERROR,
5515 (errcode(ERRCODE_DATATYPE_MISMATCH),
5516 errmsg("every bound following MINVALUE must also be MINVALUE"),
5517 parser_errposition(pstate, exprLocation((Node *) prd))));
5518 break;
5519 }
5520 }
5521}
5522
5523/*
5524 * Transform one entry in a partition bound spec, producing a constant.

Callers 1

Calls 5

parser_errpositionFunction · 0.85
exprLocationFunction · 0.85
foreachFunction · 0.50
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected