citusdata / citusdata/pg_shard
CURRENT_DATE incorrectly deparsed in SELECT queries
- Dominant language
- C
- Stars
- 1.1k
- Forks
- 62
- PR merge metrics
- No merged PRs in 30d
Description
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:
``` sql
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';
```
Contributor guide
Assessment
This issue has not been assessed yet.