6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-23 14:03:06 +01:00
firebird-qa/tests/bugs/core_1865_test.py

39 lines
1.0 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-20 17:32:14 +01:00
"""
ID: issue-2295
ISSUE: 2295
TITLE: BLR error on restore database with computed by Field
DESCRIPTION:
JIRA: CORE-1865
FBTEST: bugs.core_1865
2022-01-20 17:32:14 +01:00
"""
2021-04-26 20:07:00 +02:00
import pytest
2021-11-12 18:29:54 +01:00
from io import BytesIO
2022-01-20 17:32:14 +01:00
from firebird.qa import *
2021-11-12 18:29:54 +01:00
from firebird.driver import SrvRestoreFlag
2021-04-26 20:07:00 +02:00
2022-01-20 17:32:14 +01:00
init_script = """
2021-11-12 18:29:54 +01:00
create table tmain(id int);
create table tdetl( id int, pid int, cost numeric(12,2) );
alter table tmain
add dsum2 computed by ( (select sum(cost) from tdetl d where d.pid = tmain.id) ) ;
commit;
"""
2021-04-26 20:07:00 +02:00
2022-01-20 17:32:14 +01:00
db = db_factory(init=init_script)
2021-04-26 20:07:00 +02:00
2022-01-20 17:32:14 +01:00
act = python_act('db')
2021-04-26 20:07:00 +02:00
2022-01-20 17:32:14 +01:00
@pytest.mark.version('>=3.0')
def test_1(act: Action):
2021-11-12 18:29:54 +01:00
backup = BytesIO()
2022-01-20 17:32:14 +01:00
with act.connect_server() as srv:
srv.database.local_backup(database=act.db.db_path, backup_stream=backup)
2021-11-12 18:29:54 +01:00
backup.seek(0)
# test fails if restore raises an exception
2022-01-20 17:32:14 +01:00
srv.database.local_restore(backup_stream=backup, database=act.db.db_path,
2021-11-12 18:29:54 +01:00
flags=SrvRestoreFlag.ONE_AT_A_TIME | SrvRestoreFlag.REPLACE)
2021-04-26 20:07:00 +02:00