6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-23 05:53:06 +01:00
firebird-qa/tests/bugs/core_0101_test.py

106 lines
2.2 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-18 20:45:21 +01:00
"""
ID: issue-425
ISSUE: 425
TITLE: JOIN the same table - problem with alias names
DESCRIPTION:
JIRA: CORE-101
FBTEST: bugs.core_0101
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
-- Confirmed wrong result on WI-V1.5.6.5026, all above wirks fine.
recreate table test(id int);
insert into test values(1);
insert into test values(-1);
insert into test values(-2);
insert into test values(2);
commit;
--set plan on;
set list on;
select *
from (
select test.id a_id, b.id as b_id
from test test
join test b on test.id = b.id
) order by 1,2
;
create index test_id on test(id);
select *
from (
select test.id a_id, b.id as b_id
from test test
join test b on test.id = b.id
) order by 1,2
;
select *
from (
select test.id a_id, b.id as b_id
from (select id from test order by id) test
join (select id from test order by id) b on test.id = b.id
) order by 1,2
;
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
A_ID -2
B_ID -2
A_ID -1
B_ID -1
A_ID 1
B_ID 1
A_ID 2
B_ID 2
A_ID -2
B_ID -2
A_ID -1
B_ID -1
A_ID 1
B_ID 1
A_ID 2
B_ID 2
A_ID -2
B_ID -2
A_ID -1
B_ID -1
A_ID 1
B_ID 1
A_ID 2
B_ID 2
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