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

62 lines
1.2 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-3706
ISSUE: 3706
TITLE: Error in autonomous transaction with empty exception handler: can insert
duplicate values into PK/UK column (leads to unrestorable backup)
2022-01-22 21:59:15 +01:00
DESCRIPTION:
JIRA: CORE-3340
FBTEST: bugs.core_3340
2022-01-22 21:59:15 +01:00
"""
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
init_script = """recreate table tmp(id int not null primary key using index tmp_id_pk);
2021-04-26 20:07:00 +02:00
commit;
set transaction no wait isolation level read committed;
set term ^;
execute block as
begin
insert into tmp values(1);
insert into tmp values(2);
in autonomous transaction do begin
insert into tmp values(1);
when any do begin
--exception;
end
end
end^
set term ;^
commit;
"""
2022-01-22 21:59:15 +01:00
db = db_factory(init=init_script)
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
test_script = """select id from tmp;
2021-04-26 20:07:00 +02:00
select count(*) from tmp;
commit;"""
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
expected_stdout = """
2021-04-26 20:07:00 +02:00
ID
============
1
2
COUNT
=====================
2
"""
@pytest.mark.version('>=3.0')
2022-01-22 21:59:15 +01:00
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout
2021-04-26 20:07:00 +02:00