From: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
---|---|
To: | David Rowley <dgrowleyml(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Numeric multiplication overflow errors |
Date: | 2021-06-29 10:29:01 |
Message-ID: | CAEZATCUOR7XUDvpEYdJf1fMicbWo+Hhu3S0fcWj=PHkmJgJh7A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Thanks for looking!
On Mon, 28 Jun 2021 at 12:27, David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
>
> Instead of adding a send/recv function, unless I'm mistaken, it should
> be possible to go the whole hog and optimizing this further by instead
> of having numericvar_send(), add:
>
> static void numericvar_serialize(StringInfo buf, const NumericVar *var)
> {
> /* guts of numericvar_send() here */
> }
>
> and then rename numericvar_recv to numericvar_deserialize.
>
> That should allow the complexity to be reduced a bit further as it'll
> allow you to just serialize the NumericVar into the existing buffer
> rather than having the send function create a new one only to have the
> caller copy it back out again into another buffer. It also allows you
> to get rid of the sumX and sumX2 vars from the serialize functions.
Yes, agreed. That simplifies the code nicely as well as saving a buffer copy.
I'm not a fan of the *serialize() function names in numeric.c though
(e.g., the name numeric_serialize() seems quite misleading for what it
actually does). So rather than adding to those, I've kept the original
names. In the context where they're used, those names seem more
natural.
Regards,
Dean
Attachment | Content-Type | Size |
---|---|---|
numeric-mul-overflow-v2.patch | text/x-patch | 2.6 KB |
numeric-agg-sumX2-overflow-v2.patch | text/x-patch | 16.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2021-06-29 11:07:27 | Re: Refactor "mutually exclusive options" error reporting code in parse_subscription_options |
Previous Message | Magnus Hagander | 2021-06-29 09:48:45 | Re: PROXY protocol support |