From: | Andrey Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: Negative value of numGroups |
Date: | 2022-05-19 09:03:55 |
Message-ID: | 26c0c627-65a9-9e38-07f0-56861b75fc68@postgrespro.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On 5/17/22 20:34, Tom Lane wrote:
> Andrey Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru> writes:
>> On 13/5/2022 11:56, Andrey Lepikhov wrote:
>>> (long) Min(numGroups, (double) LONG_MAX);
>>>
>>> can return negative value, if numGroups > LONG_MAX.
>
> I see your point, but I don't think that repeating the same finicky
> and undocumented coding pattern in multiple places is a future-proof
> fix. I'm inclined to think we should invent a function along the
> lines of "long clamp_double_to_long(double x)". Given where it's
> used, maybe putting it beside clamp_row_est() would be good.
>
> regards, tom lane
Next version of the patch.
As I see, now we trying to use Cardinality type instead of double.
So, I named casting routine as clamp_cardinality_to_long.
--
Regards
Andrey Lepikhov
Postgres Professional
Attachment | Content-Type | Size |
---|---|---|
0001-Fix-potential-problem-with-negative-value-of-groups-.patch | text/x-patch | 7.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | PG Bug reporting form | 2022-05-19 12:03:37 | BUG #17486: [pg_restore] Restoring a view fails if this view contains an attribute without alias name. |
Previous Message | Michael Paquier | 2022-05-19 08:56:09 | Re: Implicitly created operator family not listed by pg_event_trigger_ddl_commands |