Re: BUG #18481: BIGINT Out of Range Error When Selecting Data

From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: dengwenking(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18481: BIGINT Out of Range Error When Selecting Data
Date: 2024-05-27 16:24:17
Message-ID: CAECtzeWJG6xj0+sMMPy6ewfCatbqdznu-JcM_o95ekeRrm+-OA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

Le lun. 27 mai 2024 à 17:57, PG Bug reporting form <noreply(at)postgresql(dot)org>
a écrit :

> The following bug has been logged on the website:
>
> Bug reference: 18481
> Logged by: Wenking Deng
> Email address: dengwenking(at)gmail(dot)com
> PostgreSQL version: 16.0
> Operating system: Ubuntu
> Description:
>
> Create the table and insert the values:
>
> CREATE TABLE t0 (c_0 BIGINT, c_1 BIGINT, c_2 BIGINT);
> INSERT INTO t0 VALUES (-9223372036854775808, 145477110, 0);
>
> Then I executed the following query:
>
> SELECT t0.c_1
> FROM t0
> WHERE (t0.c_2 <> t0.c_0 * t0.c_1 AND t0.c_0 = -9223372036854775808)
> AND t0.c_1 = 145477110;
>
> Expected Behavior:
> The query should return: 145477110
>
> Actual Behavior:
> The query results in an error: ERROR: bigint out of range
>
>
PostgreSQL is correct. Multiplying c_0 and c_1 gives a result bigger than a
bigint, hence the error.

--
Guillaume.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2024-05-28 03:01:33 BUG #18482: The first data after paging is inconsistent with the actual first data
Previous Message Pengfei Wang 2024-05-27 13:51:22 Re: issue: nbtpage.c,_bt_pagedel may get wrong result