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: Incorrect result in subquery with aggregate [CORE4574] #4891
Comments
Commented by: Sean Leyne (seanleyne) 1- This would appear to be a regression, so that should be reflected in the Subject 2- I believe that the Subject of this item should read "Incorrect result using CTE with aggregate" since the issue is with CTE not with subquery functionality. |
Commented by: Alex Bekhtin (afgm) to Sean Leyne >1- This would appear to be a regression, so that should be reflected in the Subject > 2- I believe that the Subject of this item should read "Incorrect result using CTE with aggregate" since the issue is with CTE not with subquery functionality. |
Modified by: Sean Leyne (seanleyne)summary: Incorrect result in subquery with aggregate => Regression: Incorrect result in subquery with aggregate |
Commented by: Sean Leyne (seanleyne) Please provide an example of the 'real' SQL which is failing. Using a CTE for 'dummy' data, while convenient, can obscure the real issue. |
Modified by: @dyemanovassignee: Dmitry Yemanov [ dimitr ] |
Commented by: @dyemanov Adriano, at the first glance this seemed related to CORE4084, at least the problem location is the same: RseNode::dsqlMatch. However, after comparing the node matching code with v2.5, I now wonder why we don't match RSE sub-items anymore? In v2.5, nod_rse->nod_count == 9, so PASS1_node_match is called for the every query element. But v3 checks only dsqlContext and it definitely smells like a regression. |
Modified by: @dyemanovassignee: Dmitry Yemanov [ dimitr ] => Adriano dos Santos Fernandes [ asfernandes ] |
Commented by: @asfernandes I'm now calling the super method which should compare all sub nodes. But I see that in both versions, if the two subselects are identical, it creates two mappings, which seems not obvious nor good for performance. |
Modified by: @asfernandesstatus: Open [ 1 ] => Resolved [ 5 ] resolution: Fixed [ 1 ] Fix Version: 3.0 Beta 1 [ 10332 ] |
Modified by: @pcisarstatus: Resolved [ 5 ] => Closed [ 6 ] |
Submitted by: Alex Bekhtin (afgm)
with A(ID) as
(
select 1 from rdb$database
union all
select 2 from rdb$database
union all
select 3 from rdb$database
),
B(ID1, ID2) as
(
select 1, null from rdb$database
union all
select 2, null from rdb$database
union all
select 3, null from rdb$database
)
select
sum((select count(*) from B where B.ID1 = http://A.ID))
,
sum((select count(*) from B where B.ID2 = http://A.ID))
-- must be (3,0) (FB2.5) , but not (3,3) (FB3.0)
from A
Commits: 3a6c109 FirebirdSQL/fbt-repository@8d54daa
The text was updated successfully, but these errors were encountered: