Re: BUG #18247: Integer overflow leads to negative width

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Junwang Zhao <zhjwpku(at)gmail(dot)com>, rekgrpth(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18247: Integer overflow leads to negative width
Date: 2023-12-20 02:05:06
Message-ID: CAMbWs4_V0VQhs4fuoeW0rygkwro1YfQ2sKQ-Svhj0Xpggcbc-g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Dec 19, 2023 at 11:22 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Richard Guo <guofenglinux(at)gmail(dot)com> writes:
> > On Tue, Dec 19, 2023 at 12:08 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >> Thanks for looking! Do you have an opinion about the int64-vs-double
> >> question?
>
> > To be honest, I don't have a preference on which one is better. I think
> > double is good enough for now as we don't need to worry about overflow
> > with it.
>
> After sleeping on it, I'm coming around to the idea that int64 will
> be better. The argument that convinces me is that using int64
> provides a datatype-based clue that we are working with a width
> and not a row count, cost, or selectivity number. I don't feel
> a need to go as far as invent a typedef alias like Cardinality;
> but plain "double" in the planner tends to be a rowcount estimate,
> which is not what we want people to think of.

Fair point.

> I'll make that change and push it.

Thanks for the change and pushing!

> BTW, I think it's sufficient to fix this in HEAD. The troublesome
> example seems quite artificial to me, and we've not heard field
> reports suggesting that people have had real problems here.

Agreed.

Thanks
Richard

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2023-12-20 08:51:34 BUG #18253: aarch64 oel 7 repomd.xml: [Errno 14] HTTPS Error 404
Previous Message Tom Lane 2023-12-19 15:22:20 Re: BUG #18247: Integer overflow leads to negative width