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

117 lines
2.9 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-20 17:32:14 +01:00
"""
ID: issue-1972
ISSUE: 1972
TITLE: 'select ...from...where...not in (select...from...)' no results
DESCRIPTION:
JIRA: CORE-1555
FBTEST: bugs.core_1555
2022-01-20 17:32:14 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-20 17:32:14 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-20 17:32:14 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-20 17:32:14 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
set term ^ ;
create or alter procedure tst1 returns (boxes integer) as
begin
boxes=1;
suspend;
boxes=2;
suspend;
end
^
set term ;^
commit;
2022-01-20 17:32:14 +01:00
2021-04-26 20:07:00 +02:00
recreate table frrates1 (
frrates1 integer not null,
boxes integer,
primary key(frrates1)
);
commit;
2022-01-20 17:32:14 +01:00
2021-04-26 20:07:00 +02:00
create index idx_frrates1_boxes on frrates1 (boxes);
commit;
2022-01-20 17:32:14 +01:00
2021-04-26 20:07:00 +02:00
recreate table schedpkgs1 (
schedpkgs1 integer not null,
schedule integer,
frrates1 integer,
primary key (schedpkgs1)
);
commit;
2022-01-20 17:32:14 +01:00
2021-04-26 20:07:00 +02:00
create index idx_schedpkgs1_schedule on schedpkgs1 (schedule);
commit;
2022-01-20 17:32:14 +01:00
2021-04-26 20:07:00 +02:00
insert into frrates1 (frrates1, boxes) values (11, 1);
insert into frrates1 (frrates1, boxes) values (12, 2);
commit;
2022-01-20 17:32:14 +01:00
2021-04-26 20:07:00 +02:00
insert into schedpkgs1 (schedpkgs1, schedule, frrates1) values(21, 16651, 11);
insert into schedpkgs1 (schedpkgs1, schedule, frrates1) values(22, 16651, null);
commit;
---------------------------
set list on;
select fr.boxes
from schedpkgs1 sp
join frrates1 fr on fr.frrates1=sp.frrates1
where sp.schedule = 16651;
2022-01-20 17:32:14 +01:00
2021-04-26 20:07:00 +02:00
select boxes
from tst1
where boxes not in (select fr.boxes
from schedpkgs1 sp
join frrates1 fr on fr.frrates1=sp.frrates1
where sp.schedule = 16651);
2022-01-20 17:32:14 +01:00
2021-04-26 20:07:00 +02:00
select boxes
from tst1
where boxes not in (select fr.boxes
from schedpkgs1 sp
join frrates1 fr on fr.frrates1=sp.frrates1
where sp.schedule = 16651 and fr.boxes>0);
2022-01-20 17:32:14 +01:00
2021-04-26 20:07:00 +02:00
select f2.boxes
from frrates1 f2
where f2.boxes not in (select fr.boxes
from schedpkgs1 sp
join frrates1 fr on fr.frrates1=sp.frrates1
where sp.schedule = 16651);
2022-01-20 17:32:14 +01:00
2021-04-26 20:07:00 +02:00
select f2.boxes
from frrates1 f2
where f2.boxes not in (select fr.boxes
from schedpkgs1 sp
join frrates1 fr on fr.frrates1=sp.frrates1
where sp.schedule = 16651 and fr.boxes>0);
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-20 17:32:14 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-20 17:32:14 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
BOXES 1
BOXES 2
BOXES 2
BOXES 2
BOXES 2
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-20 17:32:14 +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