]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Remove bogus assertion in transformExpressionList().
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 19 Oct 2021 15:35:15 +0000 (11:35 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 19 Oct 2021 15:35:15 +0000 (11:35 -0400)
I think when I added this assertion (in commit 8f889b108), I was only
thinking of the use of transformExpressionList at top level of INSERT
and VALUES.  But it's also called by transformRowExpr(), which can
certainly occur in an UPDATE targetlist, so it's inappropriate to
suppose that p_multiassign_exprs must be empty.  Besides, since the
input is not expected to contain ResTargets, there's no reason it
should contain MultiAssignRefs either.  Hence this code need not
be concerned about the state of p_multiassign_exprs, and we should
just drop the assertion.

Per bug #17236 from ocean_li_996.  It's been wrong for years,
so back-patch to all supported branches.

Discussion: https://postgr.es/m/17236-3210de9bcba1d7ca@postgresql.org

src/backend/parser/parse_target.c

index 6ccc14af5ea84bd41a1ff614edf302d802ef1c5d..dd74bf93e1d1dba04a8a48a36fe7bc84abfc5a85 100644 (file)
@@ -209,7 +209,9 @@ transformTargetList(ParseState *pstate, List *targetlist,
  * This is the identical transformation to transformTargetList, except that
  * the input list elements are bare expressions without ResTarget decoration,
  * and the output elements are likewise just expressions without TargetEntry
- * decoration.  We use this for ROW() and VALUES() constructs.
+ * decoration.  Also, we don't expect any multiassign constructs within the
+ * list, so there's nothing to do for that.  We use this for ROW() and
+ * VALUES() constructs.
  */
 List *
 transformExpressionList(ParseState *pstate, List *exprlist,
@@ -261,9 +263,6 @@ transformExpressionList(ParseState *pstate, List *exprlist,
                                                 transformExpr(pstate, e, exprKind));
        }
 
-       /* Shouldn't have any multiassign items here */
-       Assert(pstate->p_multiassign_exprs == NIL);
-
        return result;
 }