2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-25 22:55:48 +01:00
|
|
|
"""
|
|
|
|
ID: issue-5448
|
|
|
|
ISSUE: 5448
|
2022-02-02 15:46:19 +01:00
|
|
|
TITLE: HAVING COUNT(*) NOT IN ( <Q> ) prevent record from appearing in outer resultset
|
|
|
|
when it should be there (<Q> = resultset without nulls)
|
2022-01-25 22:55:48 +01:00
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-5165
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_5165
|
2022-01-25 22:55:48 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-25 22:55:48 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-25 22:55:48 +01:00
|
|
|
db = db_factory()
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-25 22:55:48 +01:00
|
|
|
test_script = """
|
2021-04-26 20:07:00 +02:00
|
|
|
-- Confirmed proper result on: WI-V3.0.0.32418, WI-T4.0.0.98
|
|
|
|
set list on;
|
|
|
|
set count on;
|
|
|
|
select 1 as check_ok
|
|
|
|
from rdb$database r
|
|
|
|
group by r.rdb$relation_id
|
2022-01-25 22:55:48 +01:00
|
|
|
having count(*) not in (select -1 from rdb$database r2);
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
select 2 as check_ok
|
|
|
|
from rdb$database r
|
|
|
|
group by r.rdb$relation_id
|
2022-01-25 22:55:48 +01:00
|
|
|
having count(1) not in (select -1 from rdb$database r2);
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-25 22:55:48 +01:00
|
|
|
act = isql_act('db', test_script)
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-25 22:55:48 +01:00
|
|
|
expected_stdout = """
|
2021-04-26 20:07:00 +02:00
|
|
|
CHECK_OK 1
|
|
|
|
Records affected: 1
|
|
|
|
|
|
|
|
CHECK_OK 2
|
|
|
|
Records affected: 1
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
@pytest.mark.version('>=3.0')
|
2022-01-25 22:55:48 +01:00
|
|
|
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
|
|
|
|