Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Fix misleading error message about inconsistent moving-aggregate types.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 6 Sep 2020 16:55:13 +0000 (12:55 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 6 Sep 2020 16:55:44 +0000 (12:55 -0400)
We reported the wrong types when complaining that an aggregate's
moving-aggregate implementation is inconsistent with its regular
implementation.

This was wrong since the feature was introduced, so back-patch
to all supported branches.

Jeff Janes

Discussion: https://postgr.es/m/CAMkU=1x808LH=LPhZp9mNSP0Xd1xDqEd+XeGcvEe48dfE6xV=A@mail.gmail.com

src/backend/catalog/pg_aggregate.c

index 246776093eceae45e1a2ca535f56bddf720bd5de..53b5d5f2ee2f7f202bc6e8408ac75bdcfc72698f 100644 (file)
@@ -560,8 +560,8 @@ AggregateCreate(const char *aggName,
            ereport(ERROR,
                    (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
                     errmsg("moving-aggregate implementation returns type %s, but plain implementation returns type %s",
-                           format_type_be(aggmTransType),
-                           format_type_be(aggTransType))));
+                           format_type_be(rettype),
+                           format_type_be(finaltype))));
    }
 
    /* handle sortop, if supplied */