db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Pendleton (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 02:27:32 GMT

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

Bryan Pendleton commented on DERBY-1949:
----------------------------------------

Hi Oleksandr, thanks for raising this issue.

Why do you think that the return value of 1 is obviously wrong?

The Derby documentation about the LOCATE function is rather brief, but it's not clear
to me what the intended result is for the case that you mention. I'm not quite sure
what it should mean to search for an empty string. My first reaction was that it would
be nice if LOCATE treated this as an error, but I don't see how LOCATE can return an
error; it can only return a non-negative integer according to the manual.

It seems to me that 1 is a valid return code, according to this definition: position 1 is
the first position where every character of the first parameter string is found starting
at that position in the second parameter string.

So maybe we should change the documentation to describe the behavior when
the first parameter is an empty string?



> 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: 10.1.3.1, 10.2.1.6
>         Environment: N/A
>            Reporter: Oleksandr Alesinskyy
>
> 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.


Mime
View raw message