2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
"""
|
|
|
|
ID: issue-4149
|
|
|
|
ISSUE: 4149
|
|
|
|
TITLE: Wrong data returned if a sub-query or a computed field refers to the base table in the ORDER BY clause
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-3806
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_3806
|
2022-01-22 21:59:15 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
init_script = """create table t (col1 int, col2 int, col3 int);
|
2021-04-26 20:07:00 +02:00
|
|
|
insert into t values (100, 200, 300);
|
|
|
|
insert into t values (101, 201, 301);
|
|
|
|
insert into t values (102, 202, 302);
|
|
|
|
commit;
|
|
|
|
"""
|
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
db = db_factory(init=init_script)
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
test_script = """alter table t drop col1;
|
2021-04-26 20:07:00 +02:00
|
|
|
select col2, col3 from t as t1;
|
|
|
|
select col2, col3 from t as t1 where exists (select * from t as t2 order by t1.col2 );
|
|
|
|
"""
|
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
act = isql_act('db', test_script)
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
expected_stdout = """
|
2021-04-26 20:07:00 +02:00
|
|
|
COL2 COL3
|
|
|
|
============ ============
|
|
|
|
200 300
|
|
|
|
201 301
|
|
|
|
202 302
|
|
|
|
|
|
|
|
COL2 COL3
|
|
|
|
============ ============
|
|
|
|
200 300
|
|
|
|
201 301
|
|
|
|
202 302
|
2022-01-22 21:59:15 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
@pytest.mark.version('>=3')
|
|
|
|
def test_1(act: Action):
|
|
|
|
act.expected_stdout = expected_stdout
|
|
|
|
act.execute()
|
|
|
|
assert act.clean_stdout == act.clean_expected_stdout
|
2021-04-26 20:07:00 +02:00
|
|
|
|