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

72 lines
1.4 KiB
Python
Raw Permalink Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-27 20:08:36 +01:00
"""
ID: issue-6419
ISSUE: 6419
TITLE: "No current record for fetch operation" with queries with aggregated subselect
DESCRIPTION:
JIRA: CORE-6171
FBTEST: bugs.core_6171
2022-01-27 20:08:36 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-27 20:08:36 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-27 20:08:36 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-27 20:08:36 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
set bail on;
recreate table tmain( s varchar(10) );
recreate table tdetl( s varchar(10), u int );
commit;
insert into tmain(s) values('foo');
insert into tmain(s) values('bar');
insert into tmain(s) values('rio');
insert into tmain(s) values('boo');
insert into tmain(s) values('');
commit;
insert into tdetl(s, u) values('foo', 100);
insert into tdetl(s, u) values('bar', 200);
insert into tdetl(s, u) values('rio', 300);
insert into tdetl(s, u) values('boo', 400);
commit;
create index tmain_s on tmain(s);
commit;
set heading off;
set plan on;
select r.s
from tmain r
where
r.s = ''
or (
select sum(d.u)
from tdetl d
where d.s = r.s
) > 0
;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-27 20:08:36 +01:00
act = isql_act('db', test_script, substitutions=[('[ \t]+', ' ')])
2021-04-26 20:07:00 +02:00
2022-01-27 20:08:36 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
PLAN (D NATURAL)
PLAN (R NATURAL)
2022-01-27 20:08:36 +01:00
foo
bar
rio
boo
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0.5')
2022-01-27 20:08:36 +01:00
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout