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

79 lines
1.7 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-20 17:32:14 +01:00
"""
ID: issue-2259
ISSUE: 2259
TITLE: Possible index corruption with multiply updates of the same record in the same transaction and using of savepoints
DESCRIPTION:
JIRA: CORE-1830
FBTEST: bugs.core_1830
2022-01-20 17:32:14 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-20 17:32:14 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-20 17:32:14 +01:00
init_script = """
2021-04-26 20:07:00 +02:00
create table a(id char(1), name varchar(255));
create index idx_a on a (id);
create exception ex_perm 'Something wrong occurs...';
commit ;
insert into a (id) values ('1');
commit;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-20 17:32:14 +01:00
db = db_factory(init=init_script)
2021-04-26 20:07:00 +02:00
2022-01-20 17:32:14 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
set list on;
select * from a where id = '1';
set term ^;
execute block as
begin
update a set name = 'xxx';
update a set id = '2';
exception ex_perm;
end ^
set term ; ^
select * from a ;
select * from a where id = '1' ;
commit;
select * from a ;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-20 17:32:14 +01:00
act = isql_act('db', test_script,
substitutions=[('column.*', 'column x'), ('[ \t]+', ' '),
('-At block line: [\\d]+, col: [\\d]+', '')])
2021-04-26 20:07:00 +02:00
2022-01-20 17:32:14 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
ID 1
NAME <null>
2022-01-20 17:32:14 +01:00
2021-04-26 20:07:00 +02:00
ID 1
NAME <null>
2022-01-20 17:32:14 +01:00
2021-04-26 20:07:00 +02:00
ID 1
NAME <null>
2022-01-20 17:32:14 +01:00
2021-04-26 20:07:00 +02:00
ID 1
2022-01-20 17:32:14 +01:00
NAME <null>
2021-12-22 20:23:11 +01:00
"""
2022-01-20 17:32:14 +01:00
expected_stderr = """
2021-04-26 20:07:00 +02:00
Statement failed, SQLSTATE = HY000
exception 1
-EX_PERM
2022-01-20 17:32:14 +01:00
-Something wrong occurs...
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=2.5')
2022-01-20 17:32:14 +01:00
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.expected_stderr = expected_stderr
act.execute()
assert (act.clean_stderr == act.clean_expected_stderr and
act.clean_stdout == act.clean_expected_stdout)
2021-04-26 20:07:00 +02:00