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

40 lines
1.1 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-27 20:08:36 +01:00
"""
ID: issue-6616
ISSUE: 6616
TITLE: Unable to restore database with tables using GENERATED ALWAYS AS IDENTITY
columns (ERROR:OVERRIDING SYSTEM VALUE should be used)
2022-01-27 20:08:36 +01:00
DESCRIPTION:
JIRA: CORE-6377
FBTEST: bugs.core_6377
2022-01-27 20:08:36 +01:00
"""
2021-04-26 20:07:00 +02:00
import pytest
from io import BytesIO
from pathlib import Path
2022-01-27 20:08:36 +01:00
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-27 20:08:36 +01:00
init_script = """
2021-04-26 20:07:00 +02:00
create table identity_always(id bigint generated always as identity constraint pk_identity_always primary key);
insert into identity_always default values;
2021-04-26 20:07:00 +02:00
commit;
"""
2021-04-26 20:07:00 +02:00
2022-01-27 20:08:36 +01:00
db = db_factory(init=init_script)
2021-04-26 20:07:00 +02:00
2022-01-27 20:08:36 +01:00
act = python_act('db')
2021-04-26 20:07:00 +02:00
fdb_file = temp_file('tmp_6377_rest.fdb')
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=4.0')
2022-01-27 20:08:36 +01:00
def test_1(act: Action, fdb_file: Path):
backup = BytesIO()
2022-01-27 20:08:36 +01:00
with act.connect_server() as srv:
srv.database.local_backup(database=act.db.db_path, backup_stream=backup)
backup.seek(0)
srv.database.local_restore(backup_stream=backup, database=fdb_file)
# This should pass without error
2022-01-27 20:08:36 +01:00
act.isql(switches=[act.get_dsn(fdb_file)], connect_db=False,
input='insert into identity_always default values;')