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

57 lines
1.4 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-22 21:59:15 +01:00
"""
ID: issue-4270
ISSUE: 4270
TITLE: eActivate/Activate INDEX or RESTORE not possible with NULL in unique index.
DESCRIPTION:
JIRA: CORE-3937
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
create generator gen_new_table_id;
recreate table testtable (
id integer not null,
field1 integer not null,
field2 integer not null,
field3 varchar(10),
field4 varchar(10)
);
alter table testtable add constraint pk_testtable primary key (id);
create unique index testtable_idx1 on testtable (field1, field2, field3, field4);
alter index testtable_idx1 inactive;
set term ^ ;
create or alter trigger testtable_bi for testtable
active before insert position 0
as
begin
if (new.id is null) then
new.id = gen_id(gen_new_table_id,1);
end
^
set term ;^
--commit;
insert into testtable (field1, field2, field3, field4) values (1, 2, null, null);
insert into testtable (field1, field2, field3, field4) values (1, 2, '', '');
commit;
alter index testtable_idx1 inactive;
alter index testtable_idx1 active; -- NOTE: could NOT reproduce error on WI-V2.5.1.26351
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
@pytest.mark.version('>=3')
def test_1(act: Action):
try:
act.execute()
except ExecutionError as e:
pytest.fail("Test script execution failed", pytrace=False)