Skip to content

Starting operator become unstable on indexed varchar fields #7237

@aschegolskiy

Description

@aschegolskiy

Afer upgrading FB from version 3.0.6.33328 to 3.0.10.33601 behaviour of starting operator become unstable.
Sometimes it doesn't match strings that shoud be matched.

-- Metadata. Database created with default character set UTF8 and collation UNICODE_CI

CREATE TABLE TEST (STR_FIELD VARCHAR(10) CHARACTER SET UTF8 COLLATE UNICODE_CI);
CREATE INDEX TEST_IDX1 ON TEST (STR_FIELD);
INSERT INTO TEST (STR_FIELD) VALUES ('ПАПА');
-- Tests
select * from test where str_field starting 'П'    -- Found
select * from test where str_field starting 'ПА'   -- Not found
select * from test where str_field starting 'ПАП'  -- Found
select * from test where str_field starting 'ПАПА' -- Not found

Plan
--------------------------------------------------------------------------------
PLAN (TEST INDEX (TEST_IDX1))

I think it related with index on this field. If index isn't used, it works as expected.

-- Tests
select * from test where str_field || '' starting 'П'    -- Found
select * from test where str_field || '' starting 'ПА'   -- Found
select * from test where str_field || '' starting 'ПАП'  -- Found
select * from test where str_field || '' starting 'ПАПА' -- Found

Plan
--------------------------------------------------------------------------------
PLAN (TEST NATURAL)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions