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

Regression in 3.0+: message "CTE 'X' has cyclic dependencies" appear when 'X' is alias for resultset and there is previous CTE part with the same name 'X' in the query [CORE5667] #5933

Closed
firebird-automations opened this issue Nov 22, 2017 · 6 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @pavel-zotov

This query works fine:

with
x as(
select 1 i from rdb$database
)
,y as(
select i from x
)
select * from y as z
;

But this fails:

with
x as(
select 1 i from rdb$database
)
,y as(
select i from x
)
select * from y as x ------------------ NOTE: "as X", i.e. alias for final CTE part ( "y" ) matches to 1st CTE ( "x" )
;

Statement failed, SQLSTATE = 42000
Dynamic SQL Error
-SQL error code = -104
-CTE 'X' has cyclic dependencies

Regression affected only 3.0+.
All builds of 2.5 work Ok (i've checked 2.5.0 ... 2.5.6 and current build of 2.5.8).

Commits: 9e079af b9c1f9f

@firebird-automations
Copy link
Collaborator Author

Commented by: @livius2

For me it looks better now then previously.
This should be not allowed
Because what if we change query as
Select * from y as x inner join x ...

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

assignee: Vlad Khorsun [ hvlad ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

Because of refactoring parser changes order of items in WITH list.
With restored order issue is fixed now.

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

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

resolution: Fixed [ 1 ]

Fix Version: 3.0.3 [ 10810 ]

Fix Version: 4.0 Beta 1 [ 10750 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

QA Status: No test => Done successfully

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

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