6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-02-02 02:40:42 +01:00

Added/Updated bugs\core_3834_test.py: No need to use .fbk from original ticket. Expected stdout depends now on major FB version because of changes since 5.0.0.455 in PLAN HASH when data sources have the same cardinality. See details in the test source.

This commit is contained in:
zotov 2022-04-07 15:54:51 +03:00
parent 38e749d56a
commit 511a54cde8

View File

@ -7,31 +7,43 @@ TITLE: Usage of a NATURAL JOIN with a derived table crashes the server
DESCRIPTION:
JIRA: CORE-3834
FBTEST: bugs.core_3834
NOTES:
[07.04.2022] pzotov
1. No need to use .fbk from original ticket: FB 2.5.0 crashes when executing trivial query to mon$ tables.
File 'core3834.fbk' can be removed from repo.
2. FB 5.0.0.455 and later: data sources with equal cardinality now present in the HASH plan in order they are specified in the query.
Reversed order was used before this build. Because of this, two cases of expected stdout must be taken in account, see variables
'fb3x_checked_stdout' and 'fb5x_checked_stdout'.
"""
import pytest
from firebird.qa import *
db = db_factory(from_backup='core3834.fbk')
db = db_factory()
test_script = """
set list on;
set planonly;
select r.revision
from ( select r.revision, r.stageid from tilemaps r ) r
natural join logs g
where stageid = ?
;
-- This query caused FB 2.5.0 to crash:
select * from (select * from mon$attachments a) a natural join mon$statements s where mon$stat_id = ?;
quit;
"""
act = isql_act('db', test_script)
expected_stdout = """
PLAN HASH (G NATURAL, R R NATURAL)
fb3x_checked_stdout = """
PLAN HASH (S NATURAL, A A NATURAL)
"""
fb5x_checked_stdout = """
PLAN HASH (A A NATURAL, S NATURAL)
"""
@pytest.mark.version('>=3.0')
def test_1(act: Action):
act.expected_stdout = expected_stdout
with act.connect_server() as srv:
engine_major = int(srv.info.engine_version)
act.expected_stdout = fb3x_checked_stdout if engine_major < 5 else fb5x_checked_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout