db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "A B (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-1949) locate function returns invalid value when first parameter is empty string
Date Tue, 27 Mar 2007 19:19:32 GMT

    [ https://issues.apache.org/jira/browse/DERBY-1949?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12484554

A B commented on DERBY-1949:

Bryan> I'm not quite sure what it should mean to search for an empty string. 

  ==> Implies searching a non-empty string for an empty string.

Oleksandr> there is no chance to find non-empty substring in the empty string . 

  ==> Implies searching an empty string for a non-empty string.

I think there's a disconnect between Bryan and Oleksandr with respect to which operand is
which.  And unfortunately, the documentation is not very helpful.

I ran some examples and it looks like the first argument is the string *for which* we are
searching, while the second argument is the string *to be searched*.  The only clear way the
documentation shows this is with the example:

  VALUES LOCATE('love', 'clover')

Here we are searching the word 'clover' for the word 'love'; i.e. searching the second string
for an occurence of the first string.

So if we look at Oleksandr's example:


we're searching the non-empty string "A" for the empty string.

For what it's worth, I ran the following on DB2 v8:

db2 => VALUES LOCATE('love', 'clover')


  1 record(s) selected.

db2 => values(locate('','A'))


  1 record(s) selected.

db2 => values(locate('A',''))


  1 record(s) selected.

db2 => values(locate('',''))


  1 record(s) selected.

> locate function returns invalid value when first parameter is empty string
> --------------------------------------------------------------------------
>                 Key: DERBY-1949
>                 URL: https://issues.apache.org/jira/browse/DERBY-1949
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions:,
>         Environment: N/A
>            Reporter: Oleksandr Alesinskyy
>         Assigned To: Bryan Pendleton
> locate function returns false invalid when first parameter is empty string,
> e.g. 
> values(locate('','A')
> results in 1, which is obviously wrong

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message