The following bug has been logged on the website:
Bug reference: 18924
Logged by: Adrien Ducos
Email address: sysgeo@gmail.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.