Issue Details (XML | Word | Printable)

Key: CORE-2699
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Adriano dos Santos Fernandes
Reporter: Adriano dos Santos Fernandes
Votes: 0
Watchers: 1

If you were logged in you would be able to see more operations.
Firebird Core

Common table expression context could be used with parameters

Created: 20/Oct/09 08:28 AM   Updated: 23/Sep/15 01:00 PM
Component/s: None
Affects Version/s: 2.1.0, 2.1.1, 2.1.2, 2.5 Beta 1, 2.5 Beta 2, 2.1.3
Fix Version/s: 3.0 Alpha 1

Issue Links:

QA Status: Done successfully

 Description  « Hide
Test case:
with x as (
    select 1 n from rdb$database
select * from x(10);

Obviously, parameters usage is not correct here.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Sean Leyne added a comment - 21/Oct/09 01:40 AM

Could you clarify are you saying that CTE should support parameters?

Adriano dos Santos Fernandes added a comment - 21/Oct/09 01:52 AM
The test case should result in an error, but wasn't.

Sean Leyne added a comment - 21/Oct/09 02:06 AM

Again, could you clarify, what is the error?

Dmitry Yemanov added a comment - 21/Oct/09 03:14 AM
AFAIU, the bug is that the engine silently accepts the "parametrized" syntax (10 in parenthesis in the example above) while it should throw an error, as such a feature is not intended.

Sean Leyne added a comment - 21/Oct/09 04:34 AM
If the feature is not intended, that's fine.

I should point out, however, that the readme documentation for CTEs suggests that parameters are supported:
      CTE_A [(a1, a2, ...)]
AS ( SELECT ... ),

CTE_B [(b1, b2, ...)]
AS ( SELECT ... ),
     SELECT ...
       FROM CTE_A, CTE_B, TAB1, TAB2 ...
     WHERE ...

The "CTE_A [(a1, a2, ...)]" certainly gives the impersion that parameters are supported. What else could "(a1, a2, ...)" be, but parameters?

Adriano dos Santos Fernandes added a comment - 21/Oct/09 06:42 AM
This is not parameters. This is field names, like CREATE VIEW X (a1, a2, ...) ...

What is invalid is WITH CTE_A ... SELECT * FROM CTE_A (<parameters>)

Pavel Cisar added a comment - 23/Sep/15 01:00 PM
Test created.