From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrey Lepikhov <a.lepikhov@postgrespro.ru>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: Negative value of numGroups
Date: Tue, 17 May 2022 11:34:17 -0400
Message-ID: <1584431.1652801657@sss.pgh.pa.us> (raw)
In-Reply-To: <ed1d1a2d-6061-24e5-e8eb-dbda3ec8f66c@postgrespro.ru>
References: <ebbc2efb-7ef9-bf2f-1ada-d6ec48f70e58@postgrespro.ru>
<ed1d1a2d-6061-24e5-e8eb-dbda3ec8f66c@postgrespro.ru>
Andrey Lepikhov <a.lepikhov@postgrespro.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, a.lepikhov@postgrespro.ru, pgsql-bugs@lists.postgresql.org
Subject: Re: Negative value of numGroups
In-Reply-To: <1584431.1652801657@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox