Re: [firebird-support] Strange SIMILAR TO result

2018-05-07 Thread Gabor Boros mlngl...@bgss.hu [firebird-support]
2018. 05. 07. 14:46 keltezéssel, Dimitry Sibiryakov s...@ibphoenix.com 
[firebird-support] írta:
> 07.05.2018 13:57, Gabor Boros mlngl...@bgss.hu [firebird-support] wrote:
>> So I see what you say. But result of
>>
>> SELECT CAST(''='' AS CHAR(5)) SIMILAR TO  '[A-Z]{2}[0-9A-Z]{2,13}' FROM
>> RDB$DATABASE;
>>
>> is
>>
>> ===
>> 
> 
> Perhaps, it must be CHAR(4) or VARCHAR. I'm not sure in type of implicit 
> cast result.


Ok. Thank you very much for your help!

Gabor






++

Visit http://www.firebirdsql.org and click the Documentation item
on the main (top) menu.  Try FAQ and other links from the left-side menu there.

Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/ 

++


Yahoo Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/firebird-support/join
(Yahoo! ID required)

<*> To change settings via email:
firebird-support-dig...@yahoogroups.com 
firebird-support-fullfeatu...@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
firebird-support-unsubscr...@yahoogroups.com

<*> Your use of Yahoo Groups is subject to:
https://info.yahoo.com/legal/us/yahoo/utos/terms/



Re: [firebird-support] Strange SIMILAR TO result

2018-05-07 Thread liviuslivius liviusliv...@poczta.onet.pl [firebird-support]
Ach now it is clear.
All work ok. You got false for char(5) because it work the same way as it is 
working for LIKE with char. 
TrySelect cast('ABCD' as char(5)) like 'ABCD' from rdb$database


Regards,Karol Bieniaszewski
null

Re: [firebird-support] Strange SIMILAR TO result

2018-05-07 Thread Gabor Boros mlngl...@bgss.hu [firebird-support]
2018. 05. 07. 14:31 keltezéssel, liviuslivius 
liviusliv...@poczta.onet.pl [firebird-support] írta:
> Hi,
> 
> It is false for me
> But i put '=' in single quote with double it does not work. I use 
> FB3.0.4.32954 dialect 3


Nothing double quote. ''='' is a boolean expression, empty string equal 
empty string.

Gabor






++

Visit http://www.firebirdsql.org and click the Documentation item
on the main (top) menu.  Try FAQ and other links from the left-side menu there.

Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/ 

++


Yahoo Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/firebird-support/join
(Yahoo! ID required)

<*> To change settings via email:
firebird-support-dig...@yahoogroups.com 
firebird-support-fullfeatu...@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
firebird-support-unsubscr...@yahoogroups.com

<*> Your use of Yahoo Groups is subject to:
https://info.yahoo.com/legal/us/yahoo/utos/terms/



Re: [firebird-support] Strange SIMILAR TO result

2018-05-07 Thread Dimitry Sibiryakov s...@ibphoenix.com [firebird-support]
07.05.2018 13:57, Gabor Boros mlngl...@bgss.hu [firebird-support] wrote:
> So I see what you say. But result of
> 
> SELECT CAST(''='' AS CHAR(5)) SIMILAR TO  '[A-Z]{2}[0-9A-Z]{2,13}' FROM
> RDB$DATABASE;
> 
> is
> 
> ===
> 

   Perhaps, it must be CHAR(4) or VARCHAR. I'm not sure in type of implicit 
cast result.


-- 
   WBR, SD.






++

Visit http://www.firebirdsql.org and click the Documentation item
on the main (top) menu.  Try FAQ and other links from the left-side menu there.

Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/ 

++


Yahoo Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/firebird-support/join
(Yahoo! ID required)

<*> To change settings via email:
firebird-support-dig...@yahoogroups.com 
firebird-support-fullfeatu...@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
firebird-support-unsubscr...@yahoogroups.com

<*> Your use of Yahoo Groups is subject to:
https://info.yahoo.com/legal/us/yahoo/utos/terms/



Re: [firebird-support] Strange SIMILAR TO result

2018-05-07 Thread liviuslivius liviusliv...@poczta.onet.pl [firebird-support]
Hi,
It is false for meBut i put '=' in single quote with double it does not work. I 
use FB3.0.4.32954 dialect 3
Regards,Karol Bieniaszewski
null

Re: [firebird-support] Strange SIMILAR TO result

2018-05-07 Thread Gabor Boros mlngl...@bgss.hu [firebird-support]
2018. 05. 07. 12:26 keltezéssel, Dimitry Sibiryakov s...@ibphoenix.com 
[firebird-support] írta:
> 07.05.2018 12:19, Gabor Boros mlngl...@bgss.hu [firebird-support] wrote:
>> A simple example: SELECT ''='' SIMILAR TO '[A-Z]{2}[0-9A-Z]{2,13}' FROM
>> RDB$DATABASE
>>
>> Why is the result true?
> 
> Your expression is actually calculated as "CAST(''='' as CHAR(5)) SIMILAR 
> TO
> '[A-Z]{2}[0-9A-Z]{2,13}'".
> (''='') is true and string representation of true is 'TRUE ' that matches 
> your patters.


Result of

SELECT  '*' || CAST(''='' AS CHAR(5)) || '*', 
CHARACTER_LENGTH(CAST(''='' AS CHAR(5))) FROM RDB$DATABASE

is

CONCATENATION  CHAR_LENGTH
= 
*TRUE *  5

So I see what you say. But result of

SELECT CAST(''='' AS CHAR(5)) SIMILAR TO  '[A-Z]{2}[0-9A-Z]{2,13}' FROM 
RDB$DATABASE;

is

===


So put the two case into one query

SELECT ''='' SIMILAR TO  '[A-Z]{2}[0-9A-Z]{2,13}', CAST(''='' AS 
CHAR(5)) SIMILAR TO  '[A-Z]{2}[0-9A-Z]{2,13}' FROM RDB$DATABASE;

and the result is

=== ===
  

And result of

SELECT 'TRUE ' SIMILAR TO  '[A-Z]{2}[0-9A-Z]{2,13}' FROM RDB$DATABASE

is

===


Gabor






++

Visit http://www.firebirdsql.org and click the Documentation item
on the main (top) menu.  Try FAQ and other links from the left-side menu there.

Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/ 

++


Yahoo Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/firebird-support/join
(Yahoo! ID required)

<*> To change settings via email:
firebird-support-dig...@yahoogroups.com 
firebird-support-fullfeatu...@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
firebird-support-unsubscr...@yahoogroups.com

<*> Your use of Yahoo Groups is subject to:
https://info.yahoo.com/legal/us/yahoo/utos/terms/



Re: [firebird-support] Strange SIMILAR TO result

2018-05-07 Thread Dimitry Sibiryakov s...@ibphoenix.com [firebird-support]
07.05.2018 12:19, Gabor Boros mlngl...@bgss.hu [firebird-support] wrote:
> A simple example: SELECT ''='' SIMILAR TO '[A-Z]{2}[0-9A-Z]{2,13}' FROM
> RDB$DATABASE
> 
> Why is the result true?

   Your expression is actually calculated as "CAST(''='' as CHAR(5)) SIMILAR TO 
'[A-Z]{2}[0-9A-Z]{2,13}'".
   (''='') is true and string representation of true is 'TRUE ' that matches 
your patters.


-- 
   WBR, SD.






++

Visit http://www.firebirdsql.org and click the Documentation item
on the main (top) menu.  Try FAQ and other links from the left-side menu there.

Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/ 

++


Yahoo Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/firebird-support/join
(Yahoo! ID required)

<*> To change settings via email:
firebird-support-dig...@yahoogroups.com 
firebird-support-fullfeatu...@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
firebird-support-unsubscr...@yahoogroups.com

<*> Your use of Yahoo Groups is subject to:
https://info.yahoo.com/legal/us/yahoo/utos/terms/