Troubleshooting
Problem
Prior to Netezza 5.2, when casting a double value to an integer value, if the input is a number other than integer, the operation is not handled properly and causes an "ERROR: pg_atoi" parsing error.
Symptom
The following error appears:
system(admin)=> SELECT CAST(1.27e+2 AS int);
ERROR: pg_atoi: error in "1.27e+2": can't parse ".27e+2"
system(admin)=> SELECT 1.27e+2::int;
ERROR: pg_atoi: error in "1.27e+2": can't parse ".27e+2"
Resolving The Problem
As of Netezza 5.2, casting a double value to an integer value will cast the double to the nearest integral value as shown in the following examples:
KB(ADMIN)=> SELECT CAST(1.27e+2 AS int);
?COLUMN?
----------
127
(1 row)
KB(ADMIN)=> SELECT CAST(1.56 AS int);
?COLUMN?
----------
2
(1 row)
KB(ADMIN)=> SELECT 1.27e+2::int;
?COLUMN?
----------
127
(1 row)
Historical Number
NZ602627
Was this topic helpful?
Document Information
Modified date:
17 October 2019
UID
swg21574954