On Fri, Nov 20, 2009 at 2:30 PM, priimak <prii...@stanford.edu> wrote:

> Hi.
>
> What happened to substr function. I upgraded from 3.6.7 to 3.6.20 and
> found following difference.
>
> in 3.6.7
>
> $ sqlite3 a.db
> sqlite> create table X ( v text not null );
> sqlite> insert into X ( v ) values ( "123456789" );
> sqlite> select substr( v, 0, 5 ) from X;
> 12345
>
>
> in 3.6.20
>
> sqlite> create table X ( v text not null );
> sqlite> insert into X ( v ) values ( "123456789" );
> sqlite> select substr( v, 0, 5 ) from X;
> 1234
>
> You can see that they behave differently with 3.6.7 doing the right thing.
> I did not find any mentioning of that here
> http://www.sqlite.org/changes.html
> If that is a bug, it *is* a major one!
>
>
It's not a bug.  substr() is suppose to be "1" based.
Older versions behaved incorrectly.
It was "fixed" by this ticket:
http://www.sqlite.org/cvstrac/tktview?tn=3628

-Shane



> --
> Dmitri Priimak
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to