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

                 Key: CORE-3806
                 URL: http://tracker.firebirdsql.org/browse/CORE-3806
             Project: Firebird Core
          Issue Type: Bug
          Components: Engine
    Affects Versions: 2.5.1, 2.1.4, 2.5.0, 2.0.6, 3.0 Initial, 2.1.3, 2.1.2, 
2.0.5, 2.1.1, 2.1.0
            Reporter: Dmitry Yemanov


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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to