Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CURRENT_DATE incorrectly deparsed in SELECT queries #85

Open
bonesmoses opened this issue Mar 12, 2015 · 3 comments
Open

CURRENT_DATE incorrectly deparsed in SELECT queries #85

bonesmoses opened this issue Mar 12, 2015 · 3 comments
Labels
Milestone

Comments

@bonesmoses
Copy link

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 jasonmp85 added the bug label Mar 13, 2015
@jasonmp85 jasonmp85 changed the title CURRENT_DATE improperly translated to invalid double-cast CURRENT_DATE incorrectly deparsed in SELECT queries Mar 13, 2015
@jasonmp85
Copy link
Collaborator

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
Copy link
Author

This was a 9.4.1 release from the PGDG PostgreSQL Apt repo.

@jasonmp85 jasonmp85 added this to the v1.3 milestone Sep 2, 2015
@jasonmp85
Copy link
Collaborator

This will be closed by #60.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants