public inbox for [email protected]
help / color / mirror / Atom feedorg.postgresql.util.PSQLException: ERROR: value out of range: underflow
8+ messages / 6 participants
[nested] [flat]
* org.postgresql.util.PSQLException: ERROR: value out of range: underflow
@ 2022-02-06 09:07 Thomas Markus <[email protected]>
2022-02-06 16:45 ` Re: org.postgresql.util.PSQLException: ERROR: value out of range: underflow Tom Lane <[email protected]>
0 siblings, 1 reply; 8+ messages in thread
From: Thomas Markus @ 2022-02-06 09:07 UTC (permalink / raw)
To: [email protected]
Hello
a customer got the exception "org.postgresql.util.PSQLException: ERROR:
value out of range: underflow" without any stacktrace etc.
System is Linux with PG 12.2
Once I got a similar error in Oracle so I checked double values for edge
cases (see below) but without success. This message is also not part of
pgjdbc.
Has anyone any idea where this message may originate from? The only used
datatypes for numbers are bigint, integer and double precision.
Thanks
Thomas
Test:
try (Statement s = c.createStatement()) {
s.executeUpdate("create table x (x double precision)");
}
try (PreparedStatement p = c.prepareStatement("insert into x (x) values
(?)")) {
p.setDouble(1, Double.MIN_VALUE);
p.executeUpdate();
p.setDouble(1, -Double.MIN_VALUE);
p.executeUpdate();
p.setDouble(1, Double.MIN_NORMAL);
p.executeUpdate();
p.setDouble(1, -Double.MIN_NORMAL);
p.executeUpdate();
p.setDouble(1, Double.MAX_VALUE);
p.executeUpdate();
p.setDouble(1, -Double.MAX_VALUE);
p.executeUpdate();
p.setDouble(1, Double.NEGATIVE_INFINITY);
p.executeUpdate();
p.setDouble(1, Double.POSITIVE_INFINITY);
p.executeUpdate();
p.setDouble(1, Double.NaN);
p.executeUpdate();
}
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: org.postgresql.util.PSQLException: ERROR: value out of range: underflow
2022-02-06 09:07 org.postgresql.util.PSQLException: ERROR: value out of range: underflow Thomas Markus <[email protected]>
@ 2022-02-06 16:45 ` Tom Lane <[email protected]>
2022-02-06 18:25 ` Re: org.postgresql.util.PSQLException: ERROR: value out of range: underflow Dave Cramer <[email protected]>
2022-02-07 05:39 ` Re: org.postgresql.util.PSQLException: ERROR: value out of range: underflow Thomas Markus <[email protected]>
0 siblings, 2 replies; 8+ messages in thread
From: Tom Lane @ 2022-02-06 16:45 UTC (permalink / raw)
To: Thomas Markus <[email protected]>; +Cc: [email protected]
Thomas Markus <[email protected]> writes:
> a customer got the exception "org.postgresql.util.PSQLException: ERROR:
> value out of range: underflow" without any stacktrace etc.
I'd venture that the cause is some server-side double precision
arithmetic that underflowed. It's not that hard to hit, eg
postgres=# select 1e-200::float8 * 1e-200::float8;
ERROR: value out of range: underflow
regards, tom lane
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: org.postgresql.util.PSQLException: ERROR: value out of range: underflow
2022-02-06 09:07 org.postgresql.util.PSQLException: ERROR: value out of range: underflow Thomas Markus <[email protected]>
2022-02-06 16:45 ` Re: org.postgresql.util.PSQLException: ERROR: value out of range: underflow Tom Lane <[email protected]>
@ 2022-02-06 18:25 ` Dave Cramer <[email protected]>
1 sibling, 0 replies; 8+ messages in thread
From: Dave Cramer @ 2022-02-06 18:25 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: Thomas Markus <[email protected]>; [email protected]
On Sun, 6 Feb 2022 at 11:45, Tom Lane <[email protected]> wrote:
> Thomas Markus <[email protected]> writes:
> > a customer got the exception "org.postgresql.util.PSQLException: ERROR:
> > value out of range: underflow" without any stacktrace etc.
>
> I'd venture that the cause is some server-side double precision
> arithmetic that underflowed. It's not that hard to hit, eg
>
> postgres=# select 1e-200::float8 * 1e-200::float8;
> ERROR: value out of range: underflow
>
> regards, tom lane
>
I mistakenly responded privately and OP responded to that.
Turns out a column was added with the wrong type.
Dave
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: org.postgresql.util.PSQLException: ERROR: value out of range: underflow
2022-02-06 09:07 org.postgresql.util.PSQLException: ERROR: value out of range: underflow Thomas Markus <[email protected]>
2022-02-06 16:45 ` Re: org.postgresql.util.PSQLException: ERROR: value out of range: underflow Tom Lane <[email protected]>
@ 2022-02-07 05:39 ` Thomas Markus <[email protected]>
1 sibling, 0 replies; 8+ messages in thread
From: Thomas Markus @ 2022-02-07 05:39 UTC (permalink / raw)
To: [email protected]
Am 06.02.22 um 17:45 schrieb Tom Lane:
> Thomas Markus <[email protected]> writes:
>> a customer got the exception "org.postgresql.util.PSQLException: ERROR:
>> value out of range: underflow" without any stacktrace etc.
> I'd venture that the cause is some server-side double precision
> arithmetic that underflowed. It's not that hard to hit, eg
>
> postgres=# select 1e-200::float8 * 1e-200::float8;
> ERROR: value out of range: underflow
>
> regards, tom lane
>
>
Dave answered private here:
A double in java cant hold such big numbers. In fits fine in float8
Here one of our developers added a float4 column manually instead of
float8. With float4 its easy to force that error.
regards
Thomas
^ permalink raw reply [nested|flat] 8+ messages in thread
* org.postgresql.util.PSQLException: ERROR: syntax error at or near "(" when calling org.postgresql.jdbc.PgPreparedStatement.getParameterMetaData
@ 2023-02-10 21:26 Siddharth Jain <[email protected]>
2023-02-10 21:33 ` Re: org.postgresql.util.PSQLException: ERROR: syntax error at or near "(" when calling org.postgresql.jdbc.PgPreparedStatement.getParameterMetaData Prasanth <[email protected]>
2023-02-10 21:34 ` Re: org.postgresql.util.PSQLException: ERROR: syntax error at or near "(" when calling org.postgresql.jdbc.PgPreparedStatement.getParameterMetaData David G. Johnston <[email protected]>
0 siblings, 2 replies; 8+ messages in thread
From: Siddharth Jain @ 2023-02-10 21:26 UTC (permalink / raw)
To: [email protected]
Hello,
We are using Postgres 14.4 server and 42.5.2 of org.postgresql:postgresql
to connect to it from Java.
We get following exception:
Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or
near "("
Position: 13
at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2676)
at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2366)
at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:356)
at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:316)
at
org.postgresql.jdbc.PgPreparedStatement.getParameterMetaData(PgPreparedStatement.java:1705)
at
org.apache.commons.dbcp2.DelegatingPreparedStatement.getParameterMetaData(DelegatingPreparedStatement.java:162)
at
org.apache.commons.dbcp2.DelegatingPreparedStatement.getParameterMetaData(DelegatingPreparedStatement.java:162)
at cdao.dpde.InsertHelper.setParameters(InsertHelper.java:53)
where the code in the last line is:
ParameterMetaData parameterMetaData = query.getParameterMetaData();
How can we fix this?
S.
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: org.postgresql.util.PSQLException: ERROR: syntax error at or near "(" when calling org.postgresql.jdbc.PgPreparedStatement.getParameterMetaData
2023-02-10 21:26 org.postgresql.util.PSQLException: ERROR: syntax error at or near "(" when calling org.postgresql.jdbc.PgPreparedStatement.getParameterMetaData Siddharth Jain <[email protected]>
@ 2023-02-10 21:33 ` Prasanth <[email protected]>
2023-02-10 21:56 ` Re: org.postgresql.util.PSQLException: ERROR: syntax error at or near "(" when calling org.postgresql.jdbc.PgPreparedStatement.getParameterMetaData Siddharth Jain <[email protected]>
1 sibling, 1 reply; 8+ messages in thread
From: Prasanth @ 2023-02-10 21:33 UTC (permalink / raw)
To: [email protected]
Did you check the query being used? Most likely that is where the issue would be.
On 2/10/23 3:26 PM, Siddharth Jain wrote:
> Hello,
>
> We are using Postgres 14.4 server and 42.5.2 of org.postgresql:postgresql to connect to it from Java.
> We get following exception:
> Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "("
> Position: 13
> at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2676)
> at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2366)
> at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:356)
> at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:316)
> at org.postgresql.jdbc.PgPreparedStatement.getParameterMetaData(PgPreparedStatement.java:1705)
> at org.apache.commons.dbcp2.DelegatingPreparedStatement.getParameterMetaData(DelegatingPreparedStatement.java:162)
> at org.apache.commons.dbcp2.DelegatingPreparedStatement.getParameterMetaData(DelegatingPreparedStatement.java:162)
> at cdao.dpde.InsertHelper.setParameters(InsertHelper.java:53)
> where the code in the last line is:
> ParameterMetaData parameterMetaData = query.getParameterMetaData();
>
> How can we fix this?
>
> S.
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: org.postgresql.util.PSQLException: ERROR: syntax error at or near "(" when calling org.postgresql.jdbc.PgPreparedStatement.getParameterMetaData
2023-02-10 21:26 org.postgresql.util.PSQLException: ERROR: syntax error at or near "(" when calling org.postgresql.jdbc.PgPreparedStatement.getParameterMetaData Siddharth Jain <[email protected]>
2023-02-10 21:33 ` Re: org.postgresql.util.PSQLException: ERROR: syntax error at or near "(" when calling org.postgresql.jdbc.PgPreparedStatement.getParameterMetaData Prasanth <[email protected]>
@ 2023-02-10 21:56 ` Siddharth Jain <[email protected]>
0 siblings, 0 replies; 8+ messages in thread
From: Siddharth Jain @ 2023-02-10 21:56 UTC (permalink / raw)
To: [email protected]; +Cc: [email protected]
Thanks. query was the problem indeed. My mistake.
On Fri, Feb 10, 2023 at 1:33 PM Prasanth <[email protected]> wrote:
> Did you check the query being used? Most likely that is where the issue
> would be.
>
> On 2/10/23 3:26 PM, Siddharth Jain wrote:
>
> Hello,
>
> We are using Postgres 14.4 server and 42.5.2 of org.postgresql:postgresql
> to connect to it from Java.
> We get following exception:
> Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or
> near "("
> Position: 13
> at
> org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2676)
> at
> org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2366)
> at
> org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:356)
> at
> org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:316)
> at
> org.postgresql.jdbc.PgPreparedStatement.getParameterMetaData(PgPreparedStatement.java:1705)
> at
> org.apache.commons.dbcp2.DelegatingPreparedStatement.getParameterMetaData(DelegatingPreparedStatement.java:162)
> at
> org.apache.commons.dbcp2.DelegatingPreparedStatement.getParameterMetaData(DelegatingPreparedStatement.java:162)
> at cdao.dpde.InsertHelper.setParameters(InsertHelper.java:53)
> where the code in the last line is:
> ParameterMetaData parameterMetaData = query.getParameterMetaData();
>
> How can we fix this?
>
> S.
>
>
>
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: org.postgresql.util.PSQLException: ERROR: syntax error at or near "(" when calling org.postgresql.jdbc.PgPreparedStatement.getParameterMetaData
2023-02-10 21:26 org.postgresql.util.PSQLException: ERROR: syntax error at or near "(" when calling org.postgresql.jdbc.PgPreparedStatement.getParameterMetaData Siddharth Jain <[email protected]>
@ 2023-02-10 21:34 ` David G. Johnston <[email protected]>
1 sibling, 0 replies; 8+ messages in thread
From: David G. Johnston @ 2023-02-10 21:34 UTC (permalink / raw)
To: Siddharth Jain <[email protected]>; +Cc: [email protected]
On Fri, Feb 10, 2023 at 2:26 PM Siddharth Jain <[email protected]> wrote:
>
> We are using Postgres 14.4 server and 42.5.2 of org.postgresql:postgresql
> to connect to it from Java.
> We get following exception:
> Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or
> near "("
> Position: 13
>
> where the code in the last line is:
> ParameterMetaData parameterMetaData = query.getParameterMetaData();
>
> How can we fix this?
>
>
If the broken query is one generated by the driver you probably cannot, you
would need to file a bug report. I strongly doubt your lack of
current-ness on the PostgreSQL is going to be an influence here but maybe...
In any case you are going to need something much more descriptive, and
ideally executable than this, if you actually want to debug and then file a
bug report (or fix your code if that is where the problem originates).
David J.
^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2023-02-10 21:56 UTC | newest]
Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-02-06 09:07 org.postgresql.util.PSQLException: ERROR: value out of range: underflow Thomas Markus <[email protected]>
2022-02-06 16:45 ` Tom Lane <[email protected]>
2022-02-06 18:25 ` Dave Cramer <[email protected]>
2022-02-07 05:39 ` Thomas Markus <[email protected]>
2023-02-10 21:26 org.postgresql.util.PSQLException: ERROR: syntax error at or near "(" when calling org.postgresql.jdbc.PgPreparedStatement.getParameterMetaData Siddharth Jain <[email protected]>
2023-02-10 21:33 ` Re: org.postgresql.util.PSQLException: ERROR: syntax error at or near "(" when calling org.postgresql.jdbc.PgPreparedStatement.getParameterMetaData Prasanth <[email protected]>
2023-02-10 21:56 ` Re: org.postgresql.util.PSQLException: ERROR: syntax error at or near "(" when calling org.postgresql.jdbc.PgPreparedStatement.getParameterMetaData Siddharth Jain <[email protected]>
2023-02-10 21:34 ` Re: org.postgresql.util.PSQLException: ERROR: syntax error at or near "(" when calling org.postgresql.jdbc.PgPreparedStatement.getParameterMetaData David G. Johnston <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox