cannot use prepared statement with timestamptz
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Redshift |
New
|
Undecided
|
Unassigned |
Bug Description
Redshift has 2 timestamp types: timestamp and timestamptz. Type timestamp can be used with prepared statement while attempt to do this with timestamptz throws exception.
The following SQL statement creates table that helps to reproduce the issue:
create table test_time_types (
id int,
d date,
ts timestamp,
ts_tz TIMESTAMPTZ
)
Here is a minimal java example that can help to reproduce the problem:
public class TryPs {
public static void main(String[] args) throws SQLException {
String url = args[0];
String user = args[1];
String password = args[2];
String query = args[3];
ResultSet rs = ps.executeQuery();
while (rs.next()) {
}
}
}
This utility accepts the following CLI arguments: URL, user, password, query.
This query works well: select * from test_time_types where ts<?
The following query does not work: select * from test_time_types where ts_tz<?
Exception in thread "main" java.sql.
at com.amazon.
at com.amazon.
at com.amazon.
at com.amazon.
at com.amazon.
at com.amazon.
at com.amazon.
at com.amazon.
at com.amazon.
at com.amazon.
at com.amazon.
at com.amazon.
Caused by: com.amazon.
... 12 more