2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-18 20:45:21 +01:00
|
|
|
"""
|
|
|
|
ID: issue-1353
|
2023-05-13 19:34:34 +02:00
|
|
|
ISSUE: https://github.com/FirebirdSQL/firebird/issues/1353
|
2022-01-18 20:45:21 +01:00
|
|
|
TITLE: AV when blob is used in expression index
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-952
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_0952
|
2023-05-13 06:11:18 +02:00
|
|
|
NOTES:
|
|
|
|
[13.05.2023] pzotov
|
|
|
|
Made SQL code be executed after DB initialization, i.e. using 'test_script' instead of init.
|
2022-01-18 20:45:21 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-18 20:45:21 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2023-05-13 06:11:18 +02:00
|
|
|
db = db_factory()
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2023-05-13 06:11:18 +02:00
|
|
|
test_script = """
|
|
|
|
set bail on;
|
|
|
|
set list on;
|
|
|
|
recreate table test (
|
|
|
|
id int primary key,
|
|
|
|
b1 blob sub_type 1 segment size 80,
|
|
|
|
c1 varchar(10)
|
|
|
|
);
|
|
|
|
commit;
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2023-05-13 06:11:18 +02:00
|
|
|
insert into test (id, b1, c1) values (1, 'www', 'qwer');
|
|
|
|
commit;
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2023-05-13 06:11:18 +02:00
|
|
|
create index test_blob_substr_idx on test computed by (cast(substring(b1 from 1 for 100) as varchar(100)));
|
|
|
|
commit;
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2023-05-13 06:11:18 +02:00
|
|
|
update test set test.c1 = 'asdf' where test.id = 1;
|
|
|
|
commit; -- AV here
|
|
|
|
select id, b1 as blob_id, c1 from test;
|
2021-04-26 20:07:00 +02:00
|
|
|
"""
|
|
|
|
|
2023-05-13 06:11:18 +02:00
|
|
|
act = isql_act('db', test_script, substitutions = [ ('BLOB_ID.*', ''), ] )
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2023-05-13 06:11:18 +02:00
|
|
|
expected_stdout = """
|
|
|
|
ID 1
|
|
|
|
BLOB_ID 81:0
|
|
|
|
www
|
|
|
|
C1 asdf
|
2021-04-26 20:07:00 +02:00
|
|
|
"""
|
|
|
|
|
2023-05-13 06:11:18 +02:00
|
|
|
@pytest.mark.version('>=3.0')
|
2022-01-18 20:45:21 +01:00
|
|
|
def test_1(act: Action):
|
|
|
|
act.expected_stdout = expected_stdout
|
2023-05-13 06:11:18 +02:00
|
|
|
act.execute(combine_output = True)
|
2022-01-18 20:45:21 +01:00
|
|
|
assert act.clean_stdout == act.clean_expected_stdout
|