citus
citus copied to clipboard
Error when casting text to timestamps in prepared statement
Consider the following statements:
CREATE TABLE test(t timestamptz, user_id text);
SELECT create_distributed_table('test', 'user_id');
PREPARE test_statement(text) AS
SELECT * FROM test WHERE t >= $1::timestamptz;
EXECUTE test_statement('2022-01-01');
Expected result
Query executed successfully
Actual result
[42846] ERROR: cannot cast type cstring to timestamp with time zone
Where: while executing command on localhost:5432
Environment
Citus version: 11.0-3 Postgres version: 14.4
Misc
This way of preparing statements is quite common for JDBC applications