You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "David Van Couvering (JIRA)" <de...@db.apache.org> on 2005/07/21 22:17:54 UTC

[jira] Commented: (DERBY-20) LIKE handles strings with control characters incorrectly.

    [ http://issues.apache.org/jira/browse/DERBY-20?page=comments#action_12316409 ] 

David Van Couvering commented on DERBY-20:
------------------------------------------

Paul Riethmuller writes:

That is not a Derby bug - it's being strict about the SQL standard.

Your LIKE string contains no wildcard characters, so you should write either:

   le.name = 'Ber%'
or
   le.name LIKE 'Ber\%%' ESCAPE '\'

depending on your intention.

HTH

Paul

but then Mitesh Meshwani responds:

FWIW,  We get the same result using db2jcc.jar as driver against derby
That is when using the original query (with Ber\%% for the Like clause ), we do not get the expected rows.
When using the modified query (Ber\% for the Like clause ), we get an exception with SQLSTATE=22025 ("The LIKE predicate string pattern contains an invalid occurrence of an escape character.")

Thanks,
Mitesh 

> LIKE handles strings with control characters incorrectly.
> ---------------------------------------------------------
>
>          Key: DERBY-20
>          URL: http://issues.apache.org/jira/browse/DERBY-20
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: Tulika Agrawal
>     Priority: Minor
>  Attachments: server.log
>
> Reporting for Daniel John Debrunner.
> If a string contains control characters in the regions matched 
> by wild card characters then in some situations a LIKE will 
> return false instead of true and the row will not be returned.
> Caused by the dynamic like optimization using >= with a prefix 
> which is is equivalent to >= on the prefeix appended with 
> blanks and not null (\u0000) characters.

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