This is an automated email from the ASF dual-hosted git repository.

ztao1987 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hawq.git


The following commit(s) were added to refs/heads/master by this push:
     new c1adfc2  HAWQ-1813. fix wrong judgment of union query
c1adfc2 is described below

commit c1adfc223ee4ffaffd15116adb42078aaacc66d5
Author: ztao1987 <zhenglin.ta...@gmail.com>
AuthorDate: Wed Nov 17 14:23:27 2021 +0800

    HAWQ-1813. fix wrong judgment of union query
---
 src/backend/parser/parse_clause.c | 28 ++++------------------------
 1 file changed, 4 insertions(+), 24 deletions(-)

diff --git a/src/backend/parser/parse_clause.c 
b/src/backend/parser/parse_clause.c
index 5f08dee..dc08457 100644
--- a/src/backend/parser/parse_clause.c
+++ b/src/backend/parser/parse_clause.c
@@ -3218,30 +3218,10 @@ addTargetToSortList(ParseState *pstate, TargetEntry 
*tle,
                /* if tlist item is an UNKNOWN literal, change it to TEXT */
                if (restype == UNKNOWNOID && resolveUnknown)
                {
-                       Oid             tobe_type = InvalidOid;
-                       int32   tobe_typmod;
-
-                       if (pstate->p_setopTypes)
-                       {
-                               /* UNION, etc. case. */
-                               int             idx = tle->resno - 1;
-
-                               Assert(pstate->p_setopTypmods);
-                               tobe_type = list_nth_oid(pstate->p_setopTypes, 
idx);
-                               tobe_typmod = 
list_nth_int(pstate->p_setopTypmods, idx);
-                       }
-
-                       if (!OidIsValid(tobe_type))
-                       {
-                               tobe_type = TEXTOID;
-                               tobe_typmod = -1;
-                       }
-                       tle->expr = (Expr *) coerce_type(pstate, (Node *) 
tle->expr,
-                                                                               
         restype, tobe_type, tobe_typmod,
-                                                                               
         COERCION_IMPLICIT,
-                                                                               
         COERCE_IMPLICIT_CAST,
-                                                                               
         -1);
-                       restype = tobe_type;
+                       tle->expr = (Expr *) coerce_type(
+                                       pstate, (Node *) tle->expr, restype, 
TEXTOID, -1,
+                                       COERCION_IMPLICIT, 
COERCE_IMPLICIT_CAST, -1);
+                       restype = TEXTOID;
                }
 
                sortcl->tleSortGroupRef = assignSortGroupRef(tle, targetlist);

Reply via email to