[
https://issues.apache.org/jira/browse/CALCITE-5253?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17598070#comment-17598070
]
Julian Hyde commented on CALCITE-5253:
--------------------------------------
I agree that this is a bug, and I think the {{NATURAL JOIN}} and {{USING}}
issues are the same case. And I agree that the cause is that the first join
should be producing a single join column ({{{}c{}}} in the first case,
{{deptno}} in the second) but is instead producing two.
It's unkind to call it a regression, when the whole purpose of CALCITE-5171 was
to tighten up validation.
I would expect
{code:java}
SELECT * FROM t1 natural join t2 natural join t3;{code}
to be sufficient to reproduce the problem. It is the references inside the join
that are the problem; the qualified references in the SELECT and WHERE clause
are already working fine.
> Natural join fields validation partially broken after CALCITE-5171
> ------------------------------------------------------------------
>
> Key: CALCITE-5253
> URL: https://issues.apache.org/jira/browse/CALCITE-5253
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.31.0
> Reporter: Evgeny Stanilovsky
> Assignee: Evgeny Stanilovsky
> Priority: Major
> Labels: pull-request-available
>
> Such issue is not possible for now:
> {code:java}
> CREATE TABLE t1(a INTEGER, b INTEGER, c INTEGER);
> CREATE TABLE t2(b INTEGER, c INTEGER, d INTEGER);
> CREATE TABLE t3(c INTEGER, d INTEGER, e INTEGER);
> SELECT t1.c, t2.d, t1.b, t1.a, t3.e FROM t1 natural join t2 natural join t3
> WHERE t1.a=1;
> {code}
> cause:
> {noformat}
> SqlValidatorException: Column name 'C' in NATURAL join or USING clause is not
> unique on one side of join
> {noformat}
> Was broken by:
> [1] https://issues.apache.org/jira/browse/CALCITE-5171
> So this is a regression.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)