yjhjstz commented on code in PR #904:
URL: https://github.com/apache/cloudberry/pull/904#discussion_r1945898868


##########
src/backend/parser/parse_partition_gp.c:
##########
@@ -566,27 +566,79 @@ initPartEveryIterator(ParseState *pstate, 
PartitionKeyData *partkey, const char
        if (end)
        {
                Const      *endConst;
+               Node    *expr = end;
+               PartitionRangeDatum *prd = NULL;
 
-               endConst = transformPartitionBoundValue(pstate,
-                                                                               
                end,
-                                                                               
                part_col_name,
-                                                                               
                part_col_typid,
-                                                                               
                part_col_typmod,
-                                                                               
                part_col_collation);
-               if (endConst->constisnull)
-                       ereport(ERROR,
-                               (errcode(ERRCODE_INVALID_TABLE_DEFINITION),
-                                errmsg("cannot use NULL with range partition 
specification"),
-                                parser_errposition(pstate, 
exprLocation(end))));
+               /*
+                * Infinite range bounds -- "minvalue" and "maxvalue" -- get 
passed in
+                * as ColumnRefs.
+                */
+               if (IsA(expr, ColumnRef))
+               {
+                       ColumnRef  *cref = (ColumnRef *) expr;
+                       char       *cname = NULL;
 
-               if (endInclusive)
-                       convert_exclusive_start_inclusive_end(endConst,
-                                                                               
                  part_col_typid, part_col_typmod,
-                                                                               
                  false);
-               if (endConst->constisnull)
+                       /*
+                        * There should be a single field named either 
"minvalue" or
+                        * "maxvalue".
+                        */
+                       if (list_length(cref->fields) == 1 &&
+                               IsA(linitial(cref->fields), String))
+                               cname = strVal(linitial(cref->fields));
+
+                       if (cname == NULL)
+                       {
+                               /*
+                                * ColumnRef is not in the desired 
single-field-name form. For
+                                * consistency between all partition 
strategies, let the
+                                * expression transformation report any errors 
rather than

Review Comment:
   what case cname will be NULL ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to