[
https://issues.apache.org/jira/browse/DERBY-4495?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Knut Anders Hatlen updated DERBY-4495:
--------------------------------------
Attachment: natural_preview_v2.diff
Uploading a new preview patch that addresses the known issues with the first
patch and also adds some test cases. To get the correct expansion of asterisks,
the natural join was transformed to a USING join earlier, at the end of
bindExpression(). Also, the transformation of a USING clause to a join
condition was modified so that it generates a valid join clause if there are no
common columns (otherwise it would generate an AndNode with no children and
cause a NullPointerException).
One new problem was found: Combining NATURAL with other join operators may fail
with a NullPointerException. For example, this query fails:
SELECT * FROM T1 CROSS JOIN T2 NATURAL JOIN T3
The problem appears to be that the RCL of the CROSS JOIN operation has not been
instantiated when the USING clause for the NATURAL JOIN operation is generated.
The RCL is actually still null when the expansion of asterisks happens, so
simply delaying the generation of the USING clause until we need it doesn't
prevent the NPE (we need to know the common columns to expand asterisks
correctly).
> Add NATURAL JOIN syntax
> -----------------------
>
> Key: DERBY-4495
> URL: https://issues.apache.org/jira/browse/DERBY-4495
> Project: Derby
> Issue Type: Improvement
> Components: SQL
> Affects Versions: 10.6.0.0
> Reporter: Knut Anders Hatlen
> Assignee: Knut Anders Hatlen
> Priority: Minor
> Attachments: natural_preview.diff, natural_preview_v2.diff
>
>
> It would be nice if Derby supported the NATURAL JOIN syntax (feature F401-01
> in SQL:2003).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.