Fix inconsistent equalfuncs.c behavior for FuncCall.funcformat.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 6 Jun 2021 19:46:58 +0000 (15:46 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 6 Jun 2021 19:46:58 +0000 (15:46 -0400)
Other equalfuncs.c checks on CoercionForm fields use
COMPARE_COERCIONFORM_FIELD (which makes them no-ops),
but commit 40c24bfef neglected to make _equalFuncCall
do likewise.  Fix that.

This is only strictly correct if FuncCall.funcformat has
no semantic effect, instead just determining ruleutils.c
display formatting.  40c24bfef added a couple of checks
in parse analysis that could break that rule; but on closer
inspection, they're redundant, so just take them out again.

Per report from Noah Misch.

Discussion: https://postgr.es/m/20210606063331.GC297923@rfd.leadboat.com

src/backend/nodes/equalfuncs.c
src/backend/parser/parse_clause.c
src/backend/parser/parse_func.c

index 47546739ed9fe9c732d5428f8df94b18baf20034..3033c1934c3d6bc2f3d07e4ce8d535aa19ef282b 100644 (file)
@@ -2420,7 +2420,7 @@ _equalFuncCall(const FuncCall *a, const FuncCall *b)
    COMPARE_SCALAR_FIELD(agg_star);
    COMPARE_SCALAR_FIELD(agg_distinct);
    COMPARE_SCALAR_FIELD(func_variadic);
-   COMPARE_SCALAR_FIELD(funcformat);
+   COMPARE_COERCIONFORM_FIELD(funcformat);
    COMPARE_LOCATION_FIELD(location);
 
    return true;
index 89d95d3e949b12b2034330ea80bc43b510520300..71c360bea582f2538f893fbebef455f87d1ac73a 100644 (file)
@@ -543,7 +543,6 @@ transformRangeFunction(ParseState *pstate, RangeFunction *r)
                !fc->agg_star &&
                !fc->agg_distinct &&
                !fc->func_variadic &&
-               fc->funcformat == COERCE_EXPLICIT_CALL &&
                coldeflist == NIL)
            {
                ListCell   *lc;
index baac089d68915b9bb0570c433a765b94c1e1a1e4..fb0ba58ff775f5c3dc5a72432ae398d3e173cee4 100644 (file)
@@ -222,7 +222,6 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
                           agg_order == NIL && agg_filter == NULL &&
                           !agg_star && !agg_distinct && over == NULL &&
                           !func_variadic && argnames == NIL &&
-                          funcformat == COERCE_EXPLICIT_CALL &&
                           list_length(funcname) == 1 &&
                           (actual_arg_types[0] == RECORDOID ||
                            ISCOMPLEX(actual_arg_types[0])));