#coding:utf-8 """ ID: issue-8078 ISSUE: https://github.com/FirebirdSQL/firebird/issues/8078 TITLE: SIMILAR TO with constant pattern using '|', '*', '?' or '{0,N}' doesn't work as expected DESCRIPTION: NOTES: [12.04.2024] pzotov Confirmed bug on 6.0.0.273, 5.0.1.1340. Checked on 6.0.0.312-ff9f094, 5.0.1.1378-fbd31da -- all OK. """ import pytest from firebird.qa import * db = db_factory() test_script = """ recreate table test ( id int generated by default as identity constraint pk_test primary key ,s varchar(20) ); insert into test(s) values('72644'); insert into test(s) values('72649'); set list on; set count on; select 'chk-01' as msg, t.* from test t where t.s similar to '72649|72644'; select 'chk-02' as msg, t.* from test t where t.s similar to '5*72644'; select 'chk-03' as msg, t.* from test t where t.s similar to '5?72644'; select 'chk-04' as msg, t.* from test t where t.s similar to '5{0,99}72644'; """ act = isql_act('db', test_script, substitutions=[ ('[ \\t]+', ' ') ]) @pytest.mark.version('>=3.0.0') def test_1(act: Action): expected_stdout = f""" MSG chk-01 ID 1 S 72644 MSG chk-01 ID 2 S 72649 Records affected: 2 MSG chk-02 ID 1 S 72644 Records affected: 1 MSG chk-03 ID 1 S 72644 Records affected: 1 MSG chk-04 ID 1 S 72644 Records affected: 1 """ act.expected_stdout = expected_stdout act.execute(combine_output = True) assert act.clean_stdout == act.clean_expected_stdout