]> granicus.if.org Git - postgresql/commitdiff
Get rid of COERCE_DONTCARE.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 12 Oct 2012 17:35:00 +0000 (13:35 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 12 Oct 2012 17:35:00 +0000 (13:35 -0400)
We don't need this hack any more.

src/backend/executor/functions.c
src/backend/nodes/nodeFuncs.c
src/backend/optimizer/path/equivclass.c
src/backend/optimizer/prep/prepunion.c
src/backend/optimizer/util/clauses.c
src/backend/parser/parse_agg.c
src/include/nodes/primnodes.h

index c90521246a5df3ed6f305f181fe43fa1c4efb4f2..e28fd89538d72acfcfa6a8fc0f37cb95a1e5908c 100644 (file)
@@ -1572,7 +1572,7 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList,
                                                                                                 rettype,
                                                                                                 -1,
                                                                                                 get_typcollation(rettype),
-                                                                                                COERCE_DONTCARE);
+                                                                                                COERCE_IMPLICIT_CAST);
                        /* Relabel is dangerous if TLE is a sort/group or setop column */
                        if (tle->ressortgroupref != 0 || parse->setOperations)
                                *modifyTargetList = true;
@@ -1618,7 +1618,7 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList,
                                                                                                                 rettype,
                                                                                                                 -1,
                                                                                                   get_typcollation(rettype),
-                                                                                                                COERCE_DONTCARE);
+                                                                                                                COERCE_IMPLICIT_CAST);
                                        /* Relabel is dangerous if sort/group or setop column */
                                        if (tle->ressortgroupref != 0 || parse->setOperations)
                                                *modifyTargetList = true;
@@ -1722,7 +1722,7 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList,
                                                                                                                 atttype,
                                                                                                                 -1,
                                                                                                   get_typcollation(atttype),
-                                                                                                                COERCE_DONTCARE);
+                                                                                                                COERCE_IMPLICIT_CAST);
                                        /* Relabel is dangerous if sort/group or setop column */
                                        if (tle->ressortgroupref != 0 || parse->setOperations)
                                                *modifyTargetList = true;
index b130902dcf2d7f5c4b9775a205129adb7096f26b..c52f4ed6ca8944820acf4cd36d87bc3d4ad75aaa 100644 (file)
@@ -554,8 +554,7 @@ exprIsLengthCoercion(const Node *expr, int32 *coercedTypmod)
  *
  * This is primarily intended to be used during planning.  Therefore, it
  * strips any existing RelabelType nodes to maintain the planner's invariant
- * that there are not adjacent RelabelTypes, and it uses COERCE_DONTCARE
- * which would typically be inappropriate earlier.
+ * that there are not adjacent RelabelTypes.
  */
 Node *
 relabel_to_typmod(Node *expr, int32 typmod)
@@ -569,7 +568,7 @@ relabel_to_typmod(Node *expr, int32 typmod)
 
        /* Apply new typmod, preserving the previous exposed type and collation */
        return (Node *) makeRelabelType((Expr *) expr, type, typmod, coll,
-                                                                       COERCE_DONTCARE);
+                                                                       COERCE_EXPLICIT_CAST);
 }
 
 /*
index 562177296ca501070ed65f54db62b3f0dfa8d92c..42286a17e817754e54abe21035af590056381751 100644 (file)
@@ -431,13 +431,13 @@ canonicalize_ec_expression(Expr *expr, Oid req_type, Oid req_collation)
                                                                                        req_type,
                                                                                        -1,
                                                                                        req_collation,
-                                                                                       COERCE_DONTCARE);
+                                                                                       COERCE_IMPLICIT_CAST);
                else if (exprCollation((Node *) expr) != req_collation)
                        expr = (Expr *) makeRelabelType(expr,
                                                                                        req_type,
                                                                                        exprTypmod((Node *) expr),
                                                                                        req_collation,
-                                                                                       COERCE_DONTCARE);
+                                                                                       COERCE_IMPLICIT_CAST);
        }
 
        return expr;
index 9e154e1120bed7cddd9e5827d5a5b566210c86af..b91e9f417fc47297df6d5cbe83d0c79f6867a6ff 100644 (file)
@@ -982,7 +982,7 @@ generate_setop_tlist(List *colTypes, List *colCollations,
                                                                                        exprType(expr),
                                                                                        exprTypmod(expr),
                                                                                        colColl,
-                                                                                       COERCE_DONTCARE);
+                                                                                       COERCE_IMPLICIT_CAST);
                }
 
                tle = makeTargetEntry((Expr *) expr,
index 5894dd39c178150948f429cabf31396f12c634ee..d5d3afe600003f86dcc24253096c6d07846a82e6 100644 (file)
@@ -2789,7 +2789,7 @@ eval_const_expressions_mutator(Node *node,
                                        relabel->resulttype = exprType(arg);
                                        relabel->resulttypmod = exprTypmod(arg);
                                        relabel->resultcollid = collate->collOid;
-                                       relabel->relabelformat = COERCE_DONTCARE;
+                                       relabel->relabelformat = COERCE_IMPLICIT_CAST;
                                        relabel->location = collate->location;
 
                                        /* Don't create stacked RelabelTypes */
@@ -3625,7 +3625,7 @@ simplify_function(Oid funcid, Oid result_type, int32 result_typmod,
                fexpr.funcid = funcid;
                fexpr.funcresulttype = result_type;
                fexpr.funcretset = func_form->proretset;
-               fexpr.funcformat = COERCE_DONTCARE;
+               fexpr.funcformat = COERCE_EXPLICIT_CALL;
                fexpr.funccollid = result_collid;
                fexpr.inputcollid = input_collid;
                fexpr.args = args;
@@ -3959,7 +3959,7 @@ evaluate_function(Oid funcid, Oid result_type, int32 result_typmod,
        newexpr->funcid = funcid;
        newexpr->funcresulttype = result_type;
        newexpr->funcretset = false;
-       newexpr->funcformat = COERCE_DONTCARE;          /* doesn't matter */
+       newexpr->funcformat = COERCE_EXPLICIT_CALL;     /* doesn't matter */
        newexpr->funccollid = result_collid;            /* doesn't matter */
        newexpr->inputcollid = input_collid;
        newexpr->args = args;
@@ -4089,7 +4089,7 @@ inline_function(Oid funcid, Oid result_type, Oid result_collid,
        fexpr->funcid = funcid;
        fexpr->funcresulttype = result_type;
        fexpr->funcretset = false;
-       fexpr->funcformat = COERCE_DONTCARE;            /* doesn't matter */
+       fexpr->funcformat = COERCE_EXPLICIT_CALL;       /* doesn't matter */
        fexpr->funccollid = result_collid;      /* doesn't matter */
        fexpr->inputcollid = input_collid;
        fexpr->args = args;
index d1d835b800754e1293fb29049fcf4e3cda6358db..b75b2d930d058b711af4921b35e55be52f33a886 100644 (file)
@@ -1001,7 +1001,7 @@ build_aggregate_fnexprs(Oid *agg_input_types,
                                                                                 args,
                                                                                 InvalidOid,
                                                                                 agg_input_collation,
-                                                                                COERCE_DONTCARE);
+                                                                                COERCE_EXPLICIT_CALL);
 
        /* see if we have a final function */
        if (!OidIsValid(finalfn_oid))
@@ -1027,5 +1027,5 @@ build_aggregate_fnexprs(Oid *agg_input_types,
                                                                                 args,
                                                                                 InvalidOid,
                                                                                 agg_input_collation,
-                                                                                COERCE_DONTCARE);
+                                                                                COERCE_EXPLICIT_CALL);
 }
index daabcb6cf9a137a670401d8901e290e5e01de621..a233fce003e2eafd5f4dfe3f5750a7e8be1ec535 100644 (file)
@@ -316,7 +316,7 @@ typedef enum CoercionContext
 } CoercionContext;
 
 /*
- * CoercionForm - information showing how to display a function-call node
+ * CoercionForm - how to display a node that could have come from a cast
  *
  * NB: equal() ignores CoercionForm fields, therefore this *must* not carry
  * any semantically significant information.  We need that behavior so that
@@ -328,8 +328,7 @@ typedef enum CoercionForm
 {
        COERCE_EXPLICIT_CALL,           /* display as a function call */
        COERCE_EXPLICIT_CAST,           /* display as an explicit cast */
-       COERCE_IMPLICIT_CAST,           /* implicit cast, so hide it */
-       COERCE_DONTCARE                         /* special case for planner */
+       COERCE_IMPLICIT_CAST            /* implicit cast, so hide it */
 } CoercionForm;
 
 /*