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

55 lines
1.4 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-25 22:55:48 +01:00
"""
ID: issue-5426
ISSUE: 5426
TITLE: GBAK restore failed when there is SQL function accessing table and switch -O(NE_AT_A_TIME) is used
DESCRIPTION:
JIRA: CORE-5143
FBTEST: bugs.core_5143
2022-01-25 22:55:48 +01:00
"""
2021-04-26 20:07:00 +02:00
import pytest
2021-11-29 20:54:28 +01:00
from pathlib import Path
2022-01-25 22:55:48 +01:00
from firebird.qa import *
2021-11-29 20:54:28 +01:00
from firebird.driver import SrvBackupFlag, SrvRestoreFlag
2021-04-26 20:07:00 +02:00
2022-01-25 22:55:48 +01:00
init_script = """
2021-04-26 20:07:00 +02:00
set term ^;
create or alter function f1 returns int as begin return 1; end
^
2021-11-29 20:54:28 +01:00
set term ;^
2021-04-26 20:07:00 +02:00
commit;
2021-11-29 20:54:28 +01:00
2021-04-26 20:07:00 +02:00
recreate table t1 (id int);
recreate table t2 (id int);
set term ^;
create or alter function f1 returns int
as
begin
return (select count(*) from t1) + (select count(*) from t2);
end^
2021-11-29 20:54:28 +01:00
set term ;^
2021-04-26 20:07:00 +02:00
commit;
2021-11-29 20:54:28 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-25 22:55:48 +01:00
db = db_factory(init=init_script)
2021-04-26 20:07:00 +02:00
2022-01-25 22:55:48 +01:00
act = python_act('db')
2021-04-26 20:07:00 +02:00
2021-11-29 20:54:28 +01:00
fbk_file = temp_file('core_5143.fbk')
2021-04-26 20:07:00 +02:00
2021-11-29 20:54:28 +01:00
@pytest.mark.version('>=3.0')
2022-01-25 22:55:48 +01:00
def test_1(act: Action, fbk_file: Path):
with act.connect_server() as srv:
srv.database.backup(database=act.db.db_path, backup=fbk_file,
2021-11-29 20:54:28 +01:00
verbose=True)
srv.wait()
2022-01-25 22:55:48 +01:00
srv.database.restore(database=act.db.db_path, backup=fbk_file,
2021-11-29 20:54:28 +01:00
flags=SrvRestoreFlag.REPLACE | SrvRestoreFlag.ONE_AT_A_TIME,
verbose=True)
restore_log = srv.readlines()
# Check
assert [line for line in restore_log if 'ERROR:' in line.upper()] == []