[ 
https://issues.apache.org/jira/browse/CALCITE-4915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17452525#comment-17452525
 ] 

Julian Hyde commented on CALCITE-4915:
--------------------------------------

Yes this is a bug. Behavior should be very similar to USING - which we already 
do correctly, I believe. NATURAL is basically syntactic sugar for USING - could 
your fix exploit that?

NATURAL not only affects resolution. It also affects the expansion of “*”. Did 
you check that?

It's frustrating that you log a bug and immediately submit a pull request. It 
prevents discussion before implementation. 

I don’t see why you need to add validator as a parameter.

I’d add a validator test, and some tests to join.iq, near the existing ones for 
USING, and not have quite as many SqlToRel tests (they’re difficult to audit).

if you have a query with emp NATURAL JOIN dept and join in a third table that 
also has a deptno column - using variously NATURAL, USING, and ON - it seems 
that there is potential for bugs. Can you test those cases. 

 

> Query with unqualified common column and NATURAL JOIN fails
> -----------------------------------------------------------
>
>                 Key: CALCITE-4915
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4915
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Aleksey Plekhanov
>            Assignee: Aleksey Plekhanov
>            Priority: Major
>              Labels: pull-request-available
>
> Query with unqualified common column and NATURAL JOIN:
> {noformat}
> SELECT deptno FROM emp NATURAL JOIN dept{noformat}
> Fails with "Column 'DEPTNO' is ambiguous" error.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to