2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
2022-01-27 20:08:36 +01:00
|
|
|
|
|
|
|
"""
|
|
|
|
ID: issue-6616
|
|
|
|
ISSUE: 6616
|
2022-02-02 15:46:19 +01:00
|
|
|
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
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_6377
|
2022-01-27 20:08:36 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
import pytest
|
2021-12-15 22:02:07 +01:00
|
|
|
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);
|
2021-12-15 22:02:07 +01:00
|
|
|
insert into identity_always default values;
|
2021-04-26 20:07:00 +02:00
|
|
|
commit;
|
2021-12-15 22:02:07 +01:00
|
|
|
"""
|
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
|
|
|
|
2021-12-15 22:02:07 +01:00
|
|
|
fdb_file = temp_file('tmp_6377_rest.fdb')
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2021-12-15 22:02:07 +01:00
|
|
|
@pytest.mark.version('>=4.0')
|
2022-01-27 20:08:36 +01:00
|
|
|
def test_1(act: Action, fdb_file: Path):
|
2021-12-15 22:02:07 +01:00
|
|
|
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)
|
2021-12-15 22:02:07 +01:00
|
|
|
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,
|
2021-12-15 22:02:07 +01:00
|
|
|
input='insert into identity_always default values;')
|