Issue Details (XML | Word | Printable)

Key: CORE-6145
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Adriano dos Santos Fernandes
Reporter: Alex Bekhtin
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Wrong result in "similar to" with non latin characters

Created: 18/Sep/19 02:40 PM   Updated: 23/Sep/19 12:22 PM
Component/s: Charsets/Collation
Affects Version/s: 4.0 Beta 2
Fix Version/s: None

Environment: Windows 7 64bit

QA Status: Done successfully


 Description  « Hide
select * from rdb$database where 'Я' similar to '%Я%'

FB 3.0 - 1 line
FB 4.0 - 0 lines

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Mark Rotteveel added a comment - 18/Sep/19 02:56 PM
I wonder if this is the result of the changes for CORE-5931

Adriano dos Santos Fernandes added a comment - 18/Sep/19 03:22 PM
It's working for me in Linux.

Alex Bekhtin added a comment - 18/Sep/19 03:26 PM
I loose first version of issue with environment description, sorry
Windows 7 64 bit, Firebird-4.0.0.1607 64 bit
downloaded from https://ci.appveyor.com/api/buildjobs/q9fkudf1i6aj7445/artifacts/output.zip

Adriano dos Santos Fernandes added a comment - 18/Sep/19 03:51 PM
What's the connection charset?

Test case with isql, please.

Pavel Zotov added a comment - 18/Sep/19 03:55 PM

C:\FB\40SS>chcp 1251
1251

C:\FB\40SS>isql /:e40 -ch win1251
Database: /:e40, User: SYSDBA
SQL> set count on;
SQL> set heading off;
SQL> select 1 from rdb$database where 'Я' similar to '%Я%';
Records affected: 0
SQL> quit;

C:\FB\40SS>isql /:e40
Database: /:e40, User: SYSDBA
SQL> set count on;
SQL> set heading off;
SQL> select 1 from rdb$database where 'Я' similar to '%Я%';

           1

Records affected: 1
SQL>

SQL> show version;
ISQL Version: WI-T4.0.0.1607 Firebird 4.0 Beta 1
Server version:
Firebird/Windows/AMD/Intel/x64 (access method), version "WI-T4.0.0.1607 Firebird 4.0 Beta 1"
Firebird/Windows/AMD/Intel/x64 (remote server), version "WI-T4.0.0.1607 Firebird 4.0 Beta 1/tcp (Image-PC1)/P16"
Firebird/Windows/AMD/Intel/x64 (remote interface), version "WI-T4.0.0.1607 Firebird 4.0 Beta 1/tcp (Image-PC1)/P16"
on disk structure version 13.0

Adriano dos Santos Fernandes added a comment - 18/Sep/19 03:56 PM
Also cannot reproduce in Windows with that download.

Alex Bekhtin added a comment - 18/Sep/19 03:57 PM
SET NAMES WIN1251;
CONNECT '127.0.0.1/3053:D:\........fdb' USER 'SYSDBA' PASSWORD 'masterkey';

SQL> set list on;

SQL> select * from rdb$database where 'Я' similar to '%Я%';
SQL> select * from rdb$database where 'z' similar to '%z%';

RDB$DESCRIPTION <null>
RDB$RELATION_ID 238
RDB$SECURITY_CLASS SQL$363
RDB$CHARACTER_SET_NAME WIN1251
RDB$LINGER 300
RDB$SQL_SECURITY <null>

Pavel Zotov added a comment - 18/Sep/19 03:58 PM
Compare 1st case - when we *do* specify charset - with 3.0.5 (and also specify -ch ....):

C:\FB\30SS>isql /:e30 -ch win1251
Database: /:e30, User: SYSDBA
SQL> set count on;
SQL> set heading off;
SQL> select 1 from rdb$database where 'Я' similar to '%Я%';

           1

Records affected: 1
SQL> show version;
ISQL Version: WI-V3.0.5.33171 Firebird 3.0
Server version:
Firebird/Windows/AMD/Intel/x64 (access method), version "WI-V3.0.5.33171 Firebird 3.0"
Firebird/Windows/AMD/Intel/x64 (remote server), version "WI-V3.0.5.33171 Firebird 3.0/tcp (Image-PC1)/P15"
Firebird/Windows/AMD/Intel/x64 (remote interface), version "WI-V3.0.5.33171 Firebird 3.0/tcp (Image-PC1)/P15"
on disk structure version 12.0
SQL>

Alex Bekhtin added a comment - 18/Sep/19 04:11 PM
With charset NONE result is correct.

Sean Leyne added a comment - 18/Sep/19 04:25 PM
So to summarize:

FB v3.x Charset = none -- unknown
FB v3.x Charset = win1251 -- Pass

FB v4.x Charset = none -- Pass
FB v4.x Charset = win1251 -- Fail

Pavel Zotov added a comment - 18/Sep/19 04:37 PM
> So to summarize:
> FB v3.x Charset = none -- unknown

It is also PASSES.

Adriano dos Santos Fernandes added a comment - 19/Sep/19 12:51 AM
Please try next snapshot.

Alex Bekhtin added a comment - 19/Sep/19 10:05 AM
I test it. Small difference between 3.0 and 4.0 with case insensitive

3.0
select * from rdb$database where 's' similar to '%S%' -- False
select * from rdb$database where 'я' similar to '%Я%' -- False

4.0
select * from rdb$database where 's' similar to '%S%' -- True
select * from rdb$database where 'я' similar to '%Я%' -- False

Alex Bekhtin added a comment - 19/Sep/19 11:40 AM
Another example:

select * from rdb$database where 'R' similar to 'r' -- True
select * from rdb$database where 'R' similar to 'R' -- True
select * from rdb$database where 'R' similar to '[Rr]' -- True
select * from rdb$database where 'Я' similar to 'я' -- False
select * from rdb$database where 'Я' similar to 'Я' -- True
select * from rdb$database where 'Я' similar to '[Яя]' -- False(!)

Adriano dos Santos Fernandes added a comment - 19/Sep/19 04:06 PM
Fixed. Please test again.

Pavel Zotov added a comment - 22/Sep/19 02:55 PM
Issues of *this* ticket seems to be fixed, all fine with them.
But there are some other troubles with SIMILAR TO.
2 Adriano and dimitr: please check e-mail.



Adriano dos Santos Fernandes added a comment - 23/Sep/19 12:43 AM
Pavel, I do not known what email are you talking about. I didn't received any email from you recently.

Pavel Zotov added a comment - 23/Sep/19 05:59 AM
Adriano, perhaps you've changed e-mail ? I always wrote to this: adrianosf@gmail.com
Please send me empty letter to p519446 at yandex.ru

Adriano dos Santos Fernandes added a comment - 23/Sep/19 12:22 PM
Sorry, it was in my spam folder.