BUG #18924: The "ERROR: integer out of range" should be more detailed

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: sysgeo(at)gmail(dot)com
Subject: BUG #18924: The "ERROR: integer out of range" should be more detailed
Date: 2025-05-12 08:05:41
Message-ID: 18924-58d44cde6cd6b40e@postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 18924
Logged by: Adrien Ducos
Email address: sysgeo(at)gmail(dot)com
PostgreSQL version: 17.4
Operating system: aarch64-unknown-linux-gnu (AWS RDS)
Description:

I am on postgresql version 17.4
select version();
--PostgreSQL 17.4 on aarch64-unknown-linux-gnu, compiled by gcc (GCC)
12.4.0, 64-bit
This is a simple query to reproduce:
with test_cte as (
select
5000000000.25 as very_big_number,
50000000.86 as big_number,
50000.59 as some_number,
500.56 as small_number
)
select
very_big_number::integer as very_big_integer,
big_number::integer as big_integer,
some_number::integer as some_integer,
small_number::integer as small_integer
from test_cte;
--ERROR: integer out of range
The problem here is not that the integer is out of range (5 billion is out
of range for the integer type). The problem is that the error message does
not tell me where the error is in the query.
I would like some context to find the error, that it happens on line ...
"very_big_number::integer" is out of range.
The problem is that I manage sql queries with thousands of lines that runs
during 2 hours to create my models and if I want to find the error, I have
to simplifiy and run my query 10-20 times to finaly find where the error is.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Fujii Masao 2025-05-12 09:01:53 Re: reltuples decreasing with each autovacuum run
Previous Message PG Bug reporting form 2025-05-12 06:57:45 BUG #18923: pg_dump 18beta1 fails to process complex table names