2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-27 20:08:36 +01:00
|
|
|
"""
|
|
|
|
ID: issue-6408
|
|
|
|
ISSUE: 6408
|
|
|
|
TITLE: SUBSTRING SIMILAR is described with wrong data type in DSQL
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-6159
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_6159
|
2022-01-27 20:08:36 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-27 20:08:36 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-27 20:08:36 +01:00
|
|
|
db = db_factory()
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-27 20:08:36 +01:00
|
|
|
test_script = """
|
2021-04-26 20:07:00 +02:00
|
|
|
recreate table test(id int, s varchar(1000), b blob);
|
|
|
|
insert into test(id, s,b) values( 1, 'charchar', 'fooobaar' );
|
|
|
|
insert into test(id, s,b) values( 2, 'fooobaar', 'blobblob' );
|
|
|
|
commit;
|
|
|
|
|
|
|
|
set list on;
|
|
|
|
set blob on;
|
|
|
|
set sqlda_display on;
|
|
|
|
set count on;
|
|
|
|
select x from (select substring( s similar 'c#"harc#"har' escape '#') x from test ) where x is not null;
|
|
|
|
select x from (select substring( b similar 'b#"lobb#"lob' escape '#') x from test ) where x is not null;
|
|
|
|
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-27 20:08:36 +01:00
|
|
|
act = isql_act('db', test_script, substitutions=[('^((?!sqltype|harc|lobb|affected).)*$', ''),
|
|
|
|
('[ \t]+', ' '), ('Nullable.*', 'Nullable')])
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-27 20:08:36 +01:00
|
|
|
expected_stdout = """
|
2021-04-26 20:07:00 +02:00
|
|
|
01: sqltype: 448 VARYING Nullable
|
|
|
|
X harc
|
|
|
|
Records affected: 1
|
|
|
|
|
|
|
|
01: sqltype: 520 BLOB Nullable
|
|
|
|
lobb
|
|
|
|
Records affected: 1
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
@pytest.mark.version('>=4.0')
|
2022-01-27 20:08:36 +01:00
|
|
|
def test_1(act: Action):
|
|
|
|
act.expected_stdout = expected_stdout
|
|
|
|
act.execute()
|
|
|
|
assert act.clean_stdout == act.clean_expected_stdout
|