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_0165_test.py

79 lines
1.7 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-494
ISSUE: 494
TITLE: Query using VIEW with UNION causes crash
DESCRIPTION:
NOTES:
Original test see im:
https://github.com/FirebirdSQL/fbtcs/blob/master/GTCS/tests/CF_ISQL_24.script
JIRA: CORE-165
FBTEST: bugs.core_0165
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 view v_test1 ( id, x ) as select 1, 2 from rdb$database;
recreate view v_test2 ( id, x ) as select 1, 2 from rdb$database;
commit;
recreate table test1 (
id int not null,
x int not null);
2022-01-18 20:45:21 +01:00
2021-04-26 20:07:00 +02:00
recreate table test2 (
id int not null,
y int not null);
2022-01-18 20:45:21 +01:00
2021-04-26 20:07:00 +02:00
recreate view v_test1 ( id, x ) as
select id, x
from test1
union
select id, x
from test1;
2022-01-18 20:45:21 +01:00
2021-04-26 20:07:00 +02:00
recreate view v_test2 ( id, y ) as
select id, y
from test2
union
select id, y
from test2;
commit;
insert into test1 values(1, 123);
insert into test1 values(2, 456);
insert into test2 values(3, 151);
insert into test2 values(2, 456);
insert into test2 values(1, 123);
commit;
set list on;
--set plan on;
select i.id as id_1, i.x as x, j.id as id_2, j.y as y
from v_test1 i, v_test2 j
where i.id = j.id
and j.y = (select max(x.y) from v_test2 x)
;
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
ID_1 2
X 456
ID_2 2
Y 456
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(combine_output = True)
2022-01-18 20:45:21 +01:00
assert act.clean_stdout == act.clean_expected_stdout
2021-04-26 20:07:00 +02:00