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
Two join aliases with the same name fails to deparse accurately #2642
Comments
This script reproduces the issue. Will create a directory ~/tests/ws/joinaliasXXXX where XXXX is the port parameter. (this text is a spoiler tag)
Relevant code likely steps on toes of #2435 |
Same or related bug: CREATE TABLE test (id bigserial primary key, value text not null);
SELECT create_distributed_table('test','id');
SELECT * FROM (SELECT id, random() FROM (test a JOIN test b USING (id)) join_alias) bar, test join_alias WHERE bar.id = join_alias.id;
WARNING: missing FROM-clause entry for table "join_alias_1"
...
LOG: issuing COPY (SELECT worker_column_1 AS id, worker_column_2 AS random, worker_column_3 AS id, worker_column_4 AS value FROM (SELECT bar.id AS worker_column_1, bar.random AS worker_column_2, join_alias.id AS worker_column_3, join_alias.value AS worker_column_4 FROM (SELECT join_alias_1.id, random() AS random FROM (public.test_102892 a(id, value) JOIN public.test_102892 b(id, value) USING (id)) join_alias(id, value, value_1)) bar, public.test_102892 join_alias WHERE (bar.id OPERATOR(pg_catalog.=) join_alias.id)) worker_subquery) TO STDOUT
DETAIL: on server localhost:9700
WARNING: missing FROM-clause entry for table "join_alias_1"
ERROR: failed to execute task 16 In that case, the problem seems to be in |
PostgreSQL parser already disallows the same join alias on the same level of the query such as:
In this case, we're discussing this even the aliases appear in different queries/subqueries.
Worker query:
Note that when you create such a rule (e.g.,
CREATE RULE r1 AS ON INSERT table DO query
) on non-distributed tables, the rule is saved correctly and works fine. So, it makes me think that the issue might be related to Citus' additional deparsing rules.The text was updated successfully, but these errors were encountered: