6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 21:43:06 +01:00

Added/Updated tests\bugs\core_5061_test.py: Separated query for FB 5.x: length of explained plan in previous version of query exceeded 64K.

This commit is contained in:
pavel-zotov 2023-03-04 16:33:14 +03:00
parent 1955ab2a6b
commit 3ac3b20336

View File

@ -2,7 +2,7 @@
"""
ID: issue-5348
ISSUE: 5348
ISSUE: https://github.com/FirebirdSQL/firebird/issues/5348
TITLE: ISQL plan output is unexpectedly truncated after a query is simplified to become shorter
DESCRIPTION:
Start of discussion: letter to dimitr, 30-dec-2015 13:57; its subject refers to core-4708.
@ -11,6 +11,10 @@ DESCRIPTION:
it is sufficient to check only that plan does NOT contain lines with ellipsis or 'truncated' or 'error'.
This mean that 'expected_stdout' section must be EMPTY. Otherwise expected_stdout will contain info
about error or invalid plan.
NOTES:
[04.03.2023] pzotov
Separated query for FB 5.x: length of explained plan in previous version of query exceeded 64K.
Discussion with dimitr: 17.01.2023 13:17
JIRA: CORE-5061
FBTEST: bugs.core_5061
"""
@ -20,11 +24,10 @@ from firebird.qa import *
db = db_factory()
test_script = """
set list on;
fb4x_test_sql = """
set explain on;
set planonly;
set blob all;
with recursive
r1 as (
select 1 as i from rdb$database
@ -88,11 +91,85 @@ test_script = """
;
"""
act = isql_act('db', test_script)
#######################################################################
fb5x_test_sql = """
set explain on;
set planonly;
with recursive
r1 as (
select 1 as i from rdb$database
union all
select r.i+1 from r1 r where r.i < 2
)
--select count(*) from r1;
,r2 as (
select first 1 row_number() over() i
from r1 ra
full join r1 rb on rb.i=ra.i
group by ra.i
having count(*)>0
union all
select rx.i+1 from r2 rx
where rx.i+1 <= 2
)
--select count(*) from r2
,r3 as (
select first 1 row_number() over() i
from r2 ra
full join r2 rb on rb.i=ra.i
group by ra.i
having count(*)>0
union all
select rx.i+1 from r3 rx
where rx.i+1 <= 2
)
--select count(*) from r3
,r4 as (
select first 1 row_number() over() i
from r3 ra
full join r3 rb on rb.i=ra.i
group by ra.i
having count(*)>0
union all
select rx.i+1 from r4 rx
where rx.i+1 <= 2
)
/*
,rn as (
select row_number() over() i
from rdb$database r full join rdb$database r2 on r2.rdb$relation_id=r.rdb$relation_id
group by r.rdb$relation_id
having count(*)>0
order by r.rdb$relation_id
rows 1 to 1
)
-- */
select
char_length(mon$explained_plan)
,( select count(*) from (select i from r4) )
from mon$statements
union all select 1,row_number()over() from rdb$database where exists(select 1, row_number()over() from rdb$database group by 1 having True rows 1)
union all select 1,row_number()over() from rdb$database where exists(select 1, row_number()over() from rdb$database group by 1 having True rows 1)
;
"""
act = python_act('db')
@pytest.mark.version('>=3.0')
def test_1(act: Action):
act.execute()
act.expected_stderr = ''
act.isql(switches=['-q'], input = fb4x_test_sql if act.is_version('<5') else fb5x_test_sql)
assert act.clean_stderr == act.clean_expected_stderr
i = 0
for line in act.stdout.splitlines():
i += 1