CURRENT_DATE incorrectly deparsed in SELECT queries
bonesmoses opened this issue · 3 comments
bonesmoses commented
When submitting a query to a worker node that contains CURRENT_DATE
, the term is translated to ('now'::cstring)::date
which produces the following error on the worker nodes:
ERROR: cannot cast type cstring to date at character 84
STATEMENT: SELECT NULL::unknown FROM ONLY sys_order_10130 WHERE (order_dt >= (('now'::cstring)::date - '7 days'::interval))
Steps to reproduce
After installing from a current git clone:
CREATE TABLE sys_order
(
order_id INT PRIMARY KEY,
product_id INT NOT NULL,
item_count INT NOT NULL,
order_dt DATE NOT NULL
);
SELECT master_create_distributed_table('sys_order', 'order_id');
SELECT master_create_worker_shards('sys_order', 16, 2);
INSERT INTO sys_order VALUES (1, 2, 3, '2015-03-12');
SELECT COUNT(1) FROM sys_order
WHERE order_dt >= CURRENT_DATE - INTERVAL '7 days';
jasonmp85 commented
Thanks for the clear bug report and copy-paste repro case! One more thing for posterity's sake: what version of PostgreSQL were you testing this against?
bonesmoses commented
This was a 9.4.1 release from the PGDG PostgreSQL Apt repo.