moving aggregate bad error message

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: moving aggregate bad error message
Date: 2020-09-06 16:07:16
Message-ID: CAMkU=1x808LH=LPhZp9mNSP0Xd1xDqEd+XeGcvEe48dfE6xV=A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I was wondering if I could just add minvfunc, and have the rest of the m*
functions be assumed to be the same as their non-moving counterparts.
Apparently the answer is 'no'. But in the process, I found a bad error
message. When omitting mfinalfunc when there is a finalfunc, I get the
error:

"ERROR: moving-aggregate implementation returns type jj_state, but plain
implementation returns type jj_state." A rather peculiar
complaint, analogous to the infamous "something failed: Success".

Looking at the code, it seems we are testing rettype != finaltype, but
reporting aggmTransType and aggTransType. Why aren't we reporting what we
are testing?

With the attached patch, it gives the more sensible "ERROR:
moving-aggregate implementation returns type jj_state, but plain
implementation returns type numeric."

Cheers,

Jeff

Attachment Content-Type Size
jjagg.sql text/plain 761 bytes
moving_agg_error.patch application/octet-stream 631 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-09-06 16:41:41 Re: moving aggregate bad error message
Previous Message Tom Lane 2020-09-06 15:51:25 Re: Dubious code in pg_rewind's process_target_file()