Skip to content

Crash occurs when use SIMILAR TO #6854

@pavel-zotov

Description

@pavel-zotov

Consider following script:

 set bail on;
 set list on;
 set names utf8;
 shell del c:\temp\tmp4test.fdb 2>nul;
 create database 'localhost:c:\temp\tmp4test.fdb' default character set utf8;
 show version;
 
 recreate table test(
    id int generated by default as identity constraint pk_txt primary key
   ,txt varchar(1) character set utf8
 );
 
 insert into test(txt) values('A');
 insert into test(txt) values('B'); ---------------------------------- [ 0 ]
 
 set term ^;
 execute block returns(
      o_id type of column test.id
         ,o_txt type of column test.txt
 ) as
         declare b boolean;
 begin
         for select id, txt from test as cursor c
         do begin
             o_id = c.id;
                 o_txt = c.txt;
             suspend;
                 begin
                         b = c.txt similar to 'Ⱥ{0,1}'; ------------ [ 1 ]
                         --b = c.txt similar to 'A{0,1}'; ---------------- [ 2 ]
                 when any do
                         begin
                                 --exception; -------------------------------- [ 3 ]
                         end
                 end
         end
 end
 ^
 set term ;^
 quit;

If we run it on WI-V3.0.8.33473 then FB will crash (stack-trace was created and sent to Adriano et al.)
If we comment out line marked as [ 1 ] and uncomment line [ 2 ], then script finished OK.
If we revert previous state ( make [1] uncommented and [2] commented out) but do uncomment line marked as [ 3 ] then output will be:

 O_ID 1
 O_TXT A
 
 Statement failed, SQLSTATE = 42000
 Invalid SIMILAR TO pattern
 -At block line: 13, col: 4
 -At block line: 17, col: 5

Finally, if we add to the table only ONE row (i.e. comment out, for example, line marked as [ 0 ] ) then test finished OK (no crash).

PS
Problem was found during implementing test for GH-5534. Ticket was created after Adriano request.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions