Open
Description
Driver version
Redshift version
PostgreSQL 8.0.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3), Redshift 1.0.79229
but issue doesn't seem to be related to Redshift server.
Client Operating System
mac. but NA for this issue
JAVA/JVM version
openjdk 23.0.1
Table schema
CREATE TABLE test_schema.t_decimal (
c_decimal numeric(3,1) ENCODE az64
)
DISTSTYLE AUTO;
insert into test_schema.t_decimal values (CAST('10.1' AS decimal(3, 1)));
Problem description
- Create an object of
RedshiftPreparedStatement
forSELECT * FROM "test_schema"."t_decimal" WHERE "c_decimal" = 10.1;
sql query. - Output of
RedshiftPreparedStatement.toString()
for the above query producesSELECT "c_decimal" FROM "test_schema"."t_decimal" WHERE "c_decimal" = ('10.1'::numeric)
output. Ideally it should generateSELECT "c_decimal" FROM "test_schema"."t_decimal" WHERE "c_decimal" = ('10.1'::numeric(3,1))
As we can see that the cast is missing precision ie'10.1'::numeric
vs '10.1'::numeric(3,1)
leading to no output from the Redshift database(ideally 10.1 row should be returned as an output when numeric(3,1) case is provided)
- Expected behaviour:
SELECT "c_decimal" FROM "test_schema"."t_decimal" WHERE "c_decimal" = ('10.1'::numeric)
- Actual behaviour:
SELECT "c_decimal" FROM "test_schema"."t_decimal" WHERE "c_decimal" = ('10.1'::numeric(3,1))
- Error message/stack trace:
- Any other details that can be helpful:
JDBC trace logs
Reproduction code
Metadata
Metadata
Assignees
Labels
No labels