SIMILAR TO can raise 'INVALID PATTERN' when 1) connection charset = UTF8 and 
console is narrow one (dos866 or win1251) and 2) running two separate 
statements without COMMIT between them
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: CORE-4749
                 URL: http://tracker.firebirdsql.org/browse/CORE-4749
             Project: Firebird Core
          Issue Type: Bug
          Components: Charsets/Collation
            Reporter: Pavel Zotov


OS: Windows XP

Console charset: DOS866
Database charset: NONE
Connection charset: UTF8 (should be dos866 but was occasionally selected = UTF8)

TEST-1: verify results of  old good `SIMILAR TO` rather than `SUBSTRING( ... 
SIMILAR ... )`:
======

C:\MIX\firebird\QA\fbt-repo\tmp>C:\MIX\firebird\fb30\isql.exe 
localhost/3333:e30 -ch utf8
Database:  localhost/3333:e30
SQL> select iif( 'aaxyaaxyaaaaxyaaaxyaa' similar to '%(aaxy|aaax){2,}%', 1, 0 ) 
is_matching from rdb$database;

 IS_MATCHING
============
           1

SQL> select iif( 'eiavieieav' similar to '%(ie){2,}%', 1, 0 ) is_matching from 
rdb$database;

 IS_MATCHING
============
           1

// OK

TEST-2: verify results of `SUBSTRING( ... SIMILAR  ...)` with the same 
arguments:
======

C:\MIX\firebird\QA\fbt-repo\tmp>C:\MIX\firebird\fb30\isql.exe 
localhost/3333:e30 -ch utf8
Database:  localhost/3333:e30
SQL> select substring( 'aaxyaaxyaaaaxyaaaxyaa' similar  '%\"(aaxy|aaax){2,}\"%' 
escape '\'  ) from rdb$database;

SUBSTRING
=====================
aaxyaaxy

SQL> select substring( 'eiavieieav' similar  '%\"(ie){2,}\"%' escape '\'  ) 
from rdb$database;

SUBSTRING
==========
Statement failed, SQLSTATE = 42000
Invalid SIMILAR TO pattern


TEST-3: same as test-2 but note that between two statements `COMMIT;` present:
======

C:\MIX\firebird\QA\fbt-repo\tmp>C:\MIX\firebird\fb30\isql.exe 
localhost/3333:e30 -ch utf8
Database:  localhost/3333:e30
SQL> select substring( 'aaxyaaxyaaaaxyaaaxyaa' similar  '%\"(aaxy|aaax){2,}\"%' 
escape '\'  ) from rdb$database;

SUBSTRING
=====================
aaxyaaxy

SQL> commit; ------------------------------------ <<<<<<<<<<< !! <<<<<<<<<<<<<<
SQL>
SQL> select substring( 'eiavieieav' similar  '%\"(ie){2,}\"%' escape '\'  ) 
from rdb$database;

SUBSTRING
==========
ieie

No error. 

Q-1: If test-2 failed because of mismatch charset of console and connection 
then message should be more relevant (may be 'malformed string') - ?
Q-2: Why  issuing of `COMMIT;`  in test-3 solved this  trouble ?


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to