6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 13:33:07 +01:00
firebird-qa/tests/bugs/core_0198_test.py

112 lines
2.5 KiB
Python
Raw Permalink Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-18 20:45:21 +01:00
"""
ID: issue-525
ISSUE: 525
TITLE: Wrong order by in table join storedproc
DESCRIPTION:
JIRA: CORE-198
FBTEST: bugs.core_0198
2022-01-18 20:45:21 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-18 20:45:21 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-18 20:45:21 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-18 20:45:21 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
recreate table my_table
(
k varchar(10) not null,
d1 integer,
d2 integer,
v1 varchar(10),
primary key (k)
);
set term ^;
create or alter procedure select_me returns(
data varchar(10)
) as
begin
data = 'one';
suspend;
data = 'two';
suspend;
data = 'three';
suspend;
end
^
set term ;^
commit;
insert into my_table values ('one', 1, 99, 'zz');
insert into my_table values ('two', 2, 98, 'yy');
insert into my_table values ('three', 3, 97, 'xx');
commit;
2022-01-18 20:45:21 +01:00
2021-04-26 20:07:00 +02:00
set list on;
select *
from my_table t join select_me p on (t.k = p.data)
order by t.d1
;
commit;
create index i1 on my_table(d1);
commit;
select *
from my_table t join select_me p on (t.k = p.data)
order by t.d1
;
commit;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-18 20:45:21 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-18 20:45:21 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
K one
D1 1
D2 99
V1 zz
DATA one
K two
D1 2
D2 98
V1 yy
DATA two
K three
D1 3
D2 97
V1 xx
DATA three
K one
D1 1
D2 99
V1 zz
DATA one
K two
D1 2
D2 98
V1 yy
DATA two
K three
D1 3
D2 97
V1 xx
DATA three
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-18 20:45:21 +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