[
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-01-ab-forbidReferencesInQueryBlock.diff
Attaching derby-5779-01-ab-forbidReferencesInQueryBlock.diff. This patch
prevents table function parameters from referring to other tables in the same
query block. I am running regression tests now.
There already was a place in the bind() logic for table functions where we dug
up column references inside parameter expressions. I simply inserted another
check there.
Touches the following files:
---------
M java/engine/org/apache/derby/loc/messages.xml
M java/shared/org/apache/derby/shared/common/reference/SQLState.java
Added a new error message for this condition. I considered re-using 42X04,
which we use for the parallel error with correlated subqueries in the FROM
list. However, I think that message is already too long, complicated, and
confusing.
---------
M java/engine/org/apache/derby/impl/sql/compile/FromVTI.java
The actual fix.
---------
M
java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java
New tests.
> Table functions and vtis 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
> Attachments: derby-5779-01-ab-forbidReferencesInQueryBlock.diff
>
>
> Derby lets you invoke a table function/vti 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. In particular, the sample usage for SYSCS_DIAG.SPACE_TABLE,
> given in the Reference Manual, will no longer work after fixing this bug.
> Changes to SPACE_TABLE are being discussed on DERBY-5554.
--
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