Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Common table expression context could be used with parameters [CORE2699] #3099

Closed
firebird-automations opened this issue Oct 20, 2009 · 13 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @asfernandes

Is related to QA547

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

Obviously, parameters usage is not correct here.

Commits: 0145996 ed0e0da

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0 Alpha 1 [ 10331 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: Sean Leyne (seanleyne)

Adriano,

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

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

The test case should result in an error, but wasn't.

@firebird-automations
Copy link
Collaborator Author

Commented by: Sean Leyne (seanleyne)

Adriano,

Again, could you clarify, what is the error?

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

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.

@firebird-automations
Copy link
Collaborator Author

Commented by: Sean Leyne (seanleyne)

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:
...
WITH [RECURSIVE]
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?

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

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>)

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

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

Obviously, parameters do nothing here.

=>

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

Obviously, parameters usage is not correct here.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Link: This issue is related to QA547 [ QA547 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: Done successfully

@firebird-automations
Copy link
Collaborator Author

Commented by: @pcisar

Test created.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment