[ 
https://issues.apache.org/jira/browse/DERBY-5779?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-5779:
---------------------------------

    Attachment: derby-5779-04-ab-subqueriesInFromList.diff

Attaching derby-5779-04-ab-subqueriesInFromList.diff. Second rev of patch to 
fix correlated references to outer tables by arguments to VTIs/tableFunctions 
invoked inside subqueries. I am running regression tests now.


Touches the following files:

----------

M       java/engine/org/apache/derby/impl/sql/compile/FromSubquery.java

At bind time, a subquery in the FROM list now pokes the FROM list into any VTIs 
invoked inside it.

----------

M       java/engine/org/apache/derby/impl/sql/compile/FromVTI.java

When binding VTI arguments, we check to see if they contain correlated 
references to outer query blocks. If so, we make sure that those references are 
not to tables on the FROM lists which were poked into the VTI by outer 
subqueries.

----------

M       java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java

We hit an NPE if we permute the join order, putting the subquery in the FROM 
list ahead of the tables referenced by args in its nested VTIs. We replace that 
NPE with an error message saying that we have detected an illegal reference in 
a VTI argument.


----------

M       java/engine/org/apache/derby/loc/messages.xml

We reword the 42ZB7 message to reflect the fact that it is being raised in more 
situations now.

----------

M       
java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java
M       
java/testing/org/apache/derbyTesting/functionTests/tests/lang/SysDiagVTIMappingTest.java

Additional test cases.

                
> Table functions should only accept arguments which are constant in their 
> query block.
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-5779
>                 URL: https://issues.apache.org/jira/browse/DERBY-5779
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.9.1.0
>            Reporter: Rick Hillegas
>            Assignee: Rick Hillegas
>             Fix For: 10.10.0.0
>
>         Attachments: derby-5779-01-ab-forbidReferencesInQueryBlock.diff, 
> derby-5779-02-aa-forbidReferencesToJoinedTables.diff, 
> derby-5779-03-aa-moreTests.diff, derby-5779-04-aa-subqueriesInFromList.diff, 
> derby-5779-04-ab-subqueriesInFromList.diff, releaseNote.html
>
>
> Derby lets you invoke a table function in the FROM list of a query, passing 
> in arguments built out of columns in other tables in the FROM list. This 
> syntax is illegal and the resulting queries have no meaning under the SQL 
> Standard. See the discussion on DERBY-5554. We should forbid this syntax. 
> Similar syntax involving correlated subqueries in the FROM list is already 
> forbidden. Fixing this will create a backward incompatibility which requires 
> a release note.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to