[ 
http://tracker.firebirdsql.org/browse/CORE-4740?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pavel Zotov reopened CORE-4740:
-------------------------------


Ticket should be reopened. Following query:
===
with
d(txt,ptn) as(
  select
    'aggagg',   '(a{1}gg){2}' from rdb$database union all select
    'aggagg',   '(a{0,}gg){2}' from rdb$database union all select
    'aggagg',   '(a{1}__){2}' from rdb$database union all select
    'aggagg',   '(a{1}__){1,}' from rdb$database union all select
    'aggagg',   '(a{1}[b-z]{2}){2}' from rdb$database union all select
    'XabaXa',   '([X](a|b){1,3}){2}' from rdb$database union all select
    'XabaXaba', '([X](a|b){3}){2}' from rdb$database union all select
    'XabaX',    '([X](a|b){0,3}){1,}' from rdb$database union all select
    'XabaX',    '([X](a|b){0,3}){2}' from rdb$database union all select
    'XaX',      '([X](a){0,1}){2}' from rdb$database union all select
    'XaXa',     '([X](a){1}){2}' from rdb$database union all select
    'XaXa',     '([X]a{1}){2}' from rdb$database
)
select txt, ptn, case when trim(txt) similar to trim(ptn) then 1 else 0 end 
is_match
from d;
===

-- shows totally different results in:

1. FB2.5:
========
TXT     PTN     IS_MATCH
aggagg  (a{1}gg){2}     1
aggagg  (a{0,}gg){2}    1
aggagg  (a{1}__){2}     1
aggagg  (a{1}__){1,}    1
aggagg  (a{1}[b-z]{2}){2}       1
XabaXa  ([X](a|b){1,3}){2}      0
XabaXaba        ([X](a|b){3}){2}        1
XabaX   ([X](a|b){0,3}){1,}     0
XabaX   ([X](a|b){0,3}){2}      0
XaX     ([X](a){0,1}){2}        0
XaXa    ([X](a){1}){2}  1
XaXa    ([X]a{1}){2}    1

2. FB 3.0:
=======
TXT     PTN     IS_MATCH
aggagg  (a{1}gg){2}     0
aggagg  (a{0,}gg){2}    0
aggagg  (a{1}__){2}     0
aggagg  (a{1}__){1,}    1
aggagg  (a{1}[b-z]{2}){2}       0
XabaXa  ([X](a|b){1,3}){2}      0
XabaXaba        ([X](a|b){3}){2}        0
XabaX   ([X](a|b){0,3}){1,}     0
XabaX   ([X](a|b){0,3}){2}      0
XaX     ([X](a){0,1}){2}        0
XaXa    ([X](a){1}){2}  0
XaXa    ([X]a{1}){2}    0

3. Postgresql 9.4.2:
================
TXT     PTN     IS_MATCH_PG_94
aggagg  (a{1}gg){2}     1
aggagg  (a{0,}gg){2}    1
aggagg  (a{1}__){2}     1
aggagg  (a{1}__){1,}    1
aggagg  (a{1}[b-z]{2}){2}       1
XabaXa  ([X](a|b){1,3}){2}      1
XabaXaba        ([X](a|b){3}){2}        1
XabaX   ([X](a|b){0,3}){1,}     1
XabaX   ([X](a|b){0,3}){2}      1
XaX     ([X](a){0,1}){2}        1
XaXa    ([X](a){1}){2}  1
XaXa    ([X]a{1}){2}    1



> SIMILAR TO with quantifier {n,} in the pattern: 1) fails on 2.5 ("Invalid 
> pattern"),  2) strange result in 3.0
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: CORE-4740
>                 URL: http://tracker.firebirdsql.org/browse/CORE-4740
>             Project: Firebird Core
>          Issue Type: Bug
>            Reporter: Pavel Zotov
>            Assignee: Adriano dos Santos Fernandes
>             Fix For: 3.0 Beta 2
>
>
> case-1: select iif( 'abcZ' similar to '[[:lower:]]{1,}Z', 1, 0) result from 
> rdb$database; -- NB: letter 'Z' - in upper case
> case-2: select iif( 'abcz' similar to '[[:lower:]]{1,}z', 1, 0) result from 
> rdb$database; -- NB: letter 'Z' - in lower case, as all preceding ones
> Result in WI-V2.5.4.26857 for both cases:
> ===
> Statement failed, SQLSTATE = 42000
> Invalid SIMILAR TO pattern
> ===
> Result in WI-T3.0.0.31780:
> SQL> select iif( 'abcZ' similar to '[[:lower:]]{1,}Z', 1, 0) result from 
> rdb$database;
>       RESULT
> ============
>            1
> SQL> select iif( 'abcz' similar to '[[:lower:]]{1,}z', 1, 0) result from 
> rdb$database;
>       RESULT
> ============
>            0
> Why second matching fails if we have three letters in lowercase left side 
> from 'z'  ? 
> If SIMILAR-engine count characters upto final one ('z') when it encounteres 
> {1,} than why it does NOT so in the following cases (and these are also seems 
> "invalid" for 2.5 as above):
> SQL> select iif( 'abcz' similar to '[[:lower:]]*z', 1, 0) result from 
> rdb$database;
>       RESULT
> ============
>            1
> SQL> select iif( 'abcz' similar to '[[:lower:]]+z', 1, 0) result from 
> rdb$database;
>       RESULT
> ============
>            1
> -- ?

-- 
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

        

------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to