Subject Strange problem with Firebird 2.1.1 and collations with specific locales (Full ICU libraries)
Author Svend Meyland Nicolaisen
Hello

I am running Firebird 2.1.1 with the complete version of the ICU libraries
and a strange problem has appeared. It is very simple for me to recreate
the problem as follows:

>isql -ch utf-8
CREATE DATABASE 'localhost:C:\Databases\MyDatabase.fdb' DEFAULT CHARACTER
SET UTF8;
CREATE COLLATION MyCollation FOR UTF8 FROM UNICODE CASE INSENSITIVE
'LOCALE=da_DK';
CREATE TABLE MyTable (Deleted SMALLINT,Name VARCHAR(30) COLLATE
MyCollation);
CREATE INDEX MyIndex ON MyTable (Deleted,Name);
COMMIT;
INSERT INTO MyTable(Deleted,Name) VALUES(0,'Anders');
INSERT INTO MyTable(Deleted,Name) VALUES(0,'Brian');
INSERT INTO MyTable(Deleted,Name) VALUES(0,'Carl');
INSERT INTO MyTable(Deleted,Name) VALUES(0,'Doris');
INSERT INTO MyTable(Deleted,Name) VALUES(0,'Eric');
INSERT INTO MyTable(Deleted,Name) VALUES(0,'Flemming');
INSERT INTO MyTable(Deleted,Name) VALUES(0,'George');
INSERT INTO MyTable(Deleted,Name) VALUES(0,'Hans');
INSERT INTO MyTable(Deleted,Name) VALUES(0,'Inger');
INSERT INTO MyTable(Deleted,Name) VALUES(0,'Jens');
INSERT INTO MyTable(Deleted,Name) VALUES(0,'Klaus');
INSERT INTO MyTable(Deleted,Name) VALUES(0,'Lars');
INSERT INTO MyTable(Deleted,Name) VALUES(0,'Mikkel');
INSERT INTO MyTable(Deleted,Name) VALUES(0,'Niels');
INSERT INTO MyTable(Deleted,Name) VALUES(0,'Ove');
INSERT INTO MyTable(Deleted,Name) VALUES(0,'Paul');
INSERT INTO MyTable(Deleted,Name) VALUES(0,'Q');
INSERT INTO MyTable(Deleted,Name) VALUES(0,'Rasmus');
INSERT INTO MyTable(Deleted,Name) VALUES(0,'Svend');
INSERT INTO MyTable(Deleted,Name) VALUES(0,'Torben');
COMMIT;


Now the following queries gives the expected results:

SELECT * FROM MyTable WHERE Name STARTING WITH 'A' COLLATE MyCollation;
SELECT * FROM MyTable WHERE Name STARTING WITH 'An' COLLATE MyCollation AND
DELETED=0;
SELECT * FROM MyTable WHERE Name STARTING WITH 'S' COLLATE MyCollation;
SELECT * FROM MyTable WHERE Name STARTING WITH 'S' COLLATE MyCollation AND
DELETED=0;


But the following query returns no rows at all:

SELECT * FROM MyTable WHERE Name STARTING WITH 'A' COLLATE MyCollation AND
Deleted=0;


Other queries that fail by returning no rows are:

SELECT * FROM MyTable WHERE Name STARTING WITH 'E' COLLATE MyCollation AND
Deleted=0;
SELECT * FROM MyTable WHERE Name STARTING WITH 'O' COLLATE MyCollation AND
Deleted=0;
SELECT * FROM MyTable WHERE Name STARTING WITH 'U' COLLATE MyCollation AND
Deleted=0;


As you can see I am using a collation with "custom locale" and the problem
only appears when indexes are used.

Can anybody explain why these queries fails to return any rows? Or should I
post my question in the developer forum?

I am running Firebird version 2.1.1.17910 and the full ICU libraries version
3.0.0.0 on Windows XP. The same problem appears on Windows 2003 Server.

Kind regards
Svend Nicolaisen