File tree Expand file tree Collapse file tree 1 file changed +66
-0
lines changed
Expand file tree Collapse file tree 1 file changed +66
-0
lines changed Original file line number Diff line number Diff line change 1+ #coding:utf-8
2+
3+ """
4+ ID: issue-8078
5+ ISSUE: https://github.com/FirebirdSQL/firebird/issues/8078
6+ TITLE: SIMILAR TO with constant pattern using '|', '*', '?' or '{0,N}' doesn't work as expected
7+ DESCRIPTION:
8+ NOTES:
9+ [12.04.2024] pzotov
10+ Confirmed bug on 6.0.0.273, 5.0.1.1340.
11+ Checked on 6.0.0.312-ff9f094, 5.0.1.1378-fbd31da -- all OK.
12+ """
13+
14+ import pytest
15+ from firebird .qa import *
16+
17+ db = db_factory ()
18+
19+ test_script = """
20+ recreate table test (
21+ id int generated by default as identity constraint pk_test primary key
22+ ,s varchar(20)
23+ );
24+ insert into test(s) values('72644');
25+ insert into test(s) values('72649');
26+ set list on;
27+ set count on;
28+ select 'chk-01' as msg, t.* from test t where t.s similar to '72649|72644';
29+ select 'chk-02' as msg, t.* from test t where t.s similar to '5*72644';
30+ select 'chk-03' as msg, t.* from test t where t.s similar to '5?72644';
31+ select 'chk-04' as msg, t.* from test t where t.s similar to '5{0,99}72644';
32+ """
33+
34+ act = isql_act ('db' , test_script , substitutions = [ ('[ \\ t]+' , ' ' ) ])
35+
36+ @pytest .mark .version ('>=3.0.0' )
37+ def test_1 (act : Action ):
38+
39+ expected_stdout = f"""
40+ MSG chk-01
41+ ID 1
42+ S 72644
43+ MSG chk-01
44+ ID 2
45+ S 72649
46+ Records affected: 2
47+
48+ MSG chk-02
49+ ID 1
50+ S 72644
51+ Records affected: 1
52+
53+ MSG chk-03
54+ ID 1
55+ S 72644
56+ Records affected: 1
57+
58+ MSG chk-04
59+ ID 1
60+ S 72644
61+ Records affected: 1
62+
63+ """
64+ act .expected_stdout = expected_stdout
65+ act .execute (combine_output = True )
66+ assert act .clean_stdout == act .clean_expected_stdout
You can’t perform that action at this time.
0 commit comments