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

Wrong data returned if a sub-query or a computed field refers to the base table in the ORDER BY clause [CORE3806] #4149

Closed
firebird-issue-importer opened this issue Apr 2, 2012 · 7 comments

Comments

@firebird-issue-importer
Copy link

@firebird-issue-importer firebird-issue-importer commented Apr 2, 2012

Submitted by: @dyemanov

Is related to QA497

Simplified test case:

create table t (col1 int, col2 int, col3 int);
insert into t values (100, 200, 300);
insert into t values (101, 201, 301);
insert into t values (102, 202, 302);
commit;
alter table t drop col1;
-- at this point we have data stored in format 1 but the current format is 2

select col2, col3
from t as t1
-- correct results

select col2, col3
from t as t1
where exists (select * from t as t2 order by t1.col2 )
-- wrong results: both columns return the same data

Key points to see the issue:
- storage format should differ from the current one
- inner query should have ORDER BY referencing to the base table
- base table should not have SORT plan

Regardless of how stupid such an ORDER BY clause may look, the engine should not return garbage.

Commits: fe01201 cfe3bd7 FirebirdSQL/fbt-repository@945bad5

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 2, 2012

Modified by: @dyemanov

assignee: Dmitry Yemanov [ dimitr ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 2, 2012

Modified by: @dyemanov

status: Open [ 1 ] => In Progress [ 3 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 2, 2012

Modified by: @dyemanov

status: In Progress [ 3 ] => Open [ 1 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 2, 2012

Modified by: @dyemanov

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

resolution: Fixed [ 1 ]

Fix Version: 2.5.2 [ 10450 ]

Fix Version: 3.0 Alpha 1 [ 10331 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Mar 27, 2014

Modified by: @pcisar

Link: This issue is related to QA497 [ QA497 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 10, 2014

Modified by: @pmakowski

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

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 13, 2015

Modified by: @pavel-zotov

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

QA Status: Done successfully

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