Re: Numeric multiplication overflow errors

Dean Rasheed <dean.a.rasheed@gmail.com>

From: Dean Rasheed <dean.a.rasheed@gmail.com>
To: David Rowley <dgrowleyml@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-07-01T10:02:51Z
Lists: pgsql-hackers
On Thu, 1 Jul 2021 at 10:27, Dean Rasheed <dean.a.rasheed@gmail.com> wrote:
>
> I'll post an update in a while. Thanks for the review.
>

One other thing I'm wondering about is back-patching. I was originally
thinking of these as back-patchable bug fixes, but changing the binary
format of the aggregate serialization states feels dodgy for a
back-patch.

But then, these functions are only callable in an aggregate context,
and work in pairs. It could be a problem if someone were using them to
pass state between different servers, but I see no evidence of them
being used in that way.

For reference, this will affect the following:
 - int8_avg_serialize()
 - numeric_avg_serialize()
 - numeric_poly_serialize()
 - numeric_serialize()

and the corresponding *_deserialize functions.

Regards,
Dean



Commits

  1. Fix numeric_mul() overflow due to too many digits after decimal point.

  2. Prevent numeric overflows in parallel numeric aggregates.