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 "Kim Haase (JIRA)" <ji...@apache.org> on 2014/09/09 20:45:30 UTC

[jira] [Closed] (DERBY-1703) The documentation for (or implementation of) SUBSTR(string,start,length) is wrong

     [ https://issues.apache.org/jira/browse/DERBY-1703?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kim Haase closed DERBY-1703.
----------------------------
       Resolution: Fixed
    Fix Version/s: 10.2.2.0

Seems to have been fixed as part of DERBY-1839.

> The documentation for (or implementation of) SUBSTR(string,start,length) is wrong
> ---------------------------------------------------------------------------------
>
>                 Key: DERBY-1703
>                 URL: https://issues.apache.org/jira/browse/DERBY-1703
>             Project: Derby
>          Issue Type: Bug
>          Components: Documentation
>    Affects Versions: 10.1.3.1
>            Reporter: Dyre Tjeldvoll
>            Priority: Minor
>              Labels: derby_triage10_5_2
>             Fix For: 10.2.2.0
>
>
> The latest alpha manuals say:
> "If startPosition is positive, it refers to position from the start of the source expression (counting the first character as 1). If startPosition is 
> negative, it is the position from the end of the source."
> But when I try to use substr with a negative starting position, I get:
> $ java org.apache.derby.tools.ij repro.sql
> ij version 10.2
> ij> connect 'jdbc:derby:/home/dt136804/repro;create=true;territory=en_US';
> ij> create table t1(c1 varchar(128));
> 0 rows inserted/updated/deleted
> ij> insert into t1 values ('The dog ate my homework');
> 1 row inserted/updated/deleted
> ij> select substr(c1,-1,8) from t1;
> 1       
> --------
> ERROR 22011: The second or third argument of the SUBSTR function is out of range.
> and not 'homework' as I would expect.
> The SQL standard (2003) does not seem to say anything about negative starting positions...



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)