2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-18 11:45:40 +01:00
|
|
|
"""
|
2022-01-18 20:45:21 +01:00
|
|
|
ID: issue-416
|
2022-01-18 11:45:40 +01:00
|
|
|
ISSUE: 416
|
|
|
|
TITLE: Recreate and self-referencing indexes
|
|
|
|
DESCRIPTION:
|
2022-01-18 20:45:21 +01:00
|
|
|
JIRA: CORE-91
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_0091
|
2022-01-18 11:45:40 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-18 11:45:40 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-18 11:45:40 +01:00
|
|
|
init_script = """recreate table t2 (
|
2021-04-26 20:07:00 +02:00
|
|
|
i integer not null primary key,
|
|
|
|
p integer references t2(i) on delete set null
|
|
|
|
);
|
|
|
|
commit;
|
|
|
|
"""
|
|
|
|
|
2022-01-18 11:45:40 +01:00
|
|
|
db = db_factory(init=init_script)
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-18 11:45:40 +01:00
|
|
|
test_script = """select * from t2;
|
2021-04-26 20:07:00 +02:00
|
|
|
insert into t2 values (1, null);
|
|
|
|
delete from t2 where i=1;
|
|
|
|
commit;
|
|
|
|
|
|
|
|
recreate table t2 (
|
|
|
|
i integer not null primary key,
|
|
|
|
p integer references t2(i) on delete set null
|
|
|
|
);
|
|
|
|
commit;
|
|
|
|
select * from t2;
|
|
|
|
insert into t2 values (1, null);
|
|
|
|
delete from t2 where i=1;
|
|
|
|
commit;
|
|
|
|
"""
|
|
|
|
|
2022-01-18 11:45:40 +01:00
|
|
|
act = isql_act('db', test_script)
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-18 11:45:40 +01:00
|
|
|
@pytest.mark.version('>=3')
|
|
|
|
def test_1(act: Action):
|
2022-01-25 22:55:48 +01:00
|
|
|
act.execute()
|
2022-01-18 20:45:21 +01:00
|
|
|
|
2021-04-26 20:07:00 +02:00
|
|
|
|