Subject UPPER on calculated field with WIN1252/PXW_SWEDFIN
Author dmarmur2002
I have a problem with select statements on swedish characters. To
reproduce the problem, create a dialect 3 database with the
WIN1252 character set as default, execute the ib_udf.sql file
and run the following statements:

CREATE TABLE TESTTABLE_III (
ID INTEGER NOT NULL,
NAME VARCHAR(80) COLLATE PXW_SWEDFIN,
XNAME VARCHAR(40) COLLATE PXW_SWEDFIN,
FULL_NAME COMPUTED BY (LTRIM(XNAME || ' ' || NAME)));

ALTER TABLE TESTTABLE_III ADD PRIMARY KEY (ID);

update RDB$RELATION_FIELDS set
RDB$COLLATION_ID = 5
where (RDB$FIELD_NAME = 'FULL_NAME') and
(RDB$RELATION_NAME = 'TESTTABLE_III')

INSERT INTO TESTTABLE_III (ID, NAME, XNAME)
VALUES(1, 'PER ÖSTLIND', '');

INSERT INTO TESTTABLE_III (ID, NAME, XNAME)
VALUES(2, 'Per Östlind', '');

INSERT INTO TESTTABLE_III (ID, NAME, XNAME)
VALUES(3, 'Per Frånberg', '');

INSERT INTO TESTTABLE_III (ID, NAME, XNAME)
VALUES(4, 'PER FRÅNBERG', '');

Then when I select like this:

SELECT * FROM testtable_III
WHERE UPPER(FULL_NAME) CONTAINING 'ER ÖST';

I get 2 rows - ok.

SELECT * FROM testtable_III
WHERE UPPER(FULL_NAME) CONTAINING 'ER FRÅN';

I get 1 row (If I use 'FRåN' i get record number 3 and if i
use 'FRÅN' i get record number 4).

It seems FB cannot do UPPER on the calculated field. My admin tool
(IB Expert) shows that I have character set WIN1252 on all VARCHAR
rows. I suspect the tool has used some tecnique similar to what
I've done to set the collation for the calculated field concerning
the character set for that field (manipulating metadata directly
instead of via ALTER och CREATE sql clauses). Maybe this is where
things fail?

I need some help as how to go around this problem. Thank you very
much,

/Dany