Bug 20929 - substr broken
Summary: substr broken
Status: CLOSED NOTABUG
Alias: None
Product: Sisyphus
Classification: Development
Component: sqlite3 (show other bugs)
Version: unstable
Hardware: all Linux
: P3 major
Assignee: Vladimir D. Seleznev
QA Contact: qa-sisyphus
URL: http://www.sqlite.org/cvstrac/tktview...
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-01 20:18 MSD by viy
Modified: 2012-03-16 14:00 MSK (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description viy 2009-08-01 20:18:17 MSD
перестали работать встроенные функции работы со строками.
sqlite> select substr('teststring',0,1);
 
sqlite> 

должно быть substr('teststring',0,1) == 't'
a оно ''.
Comment 1 viy 2009-08-01 20:19:50 MSD
3.6.16-alt1
Comment 2 viy 2009-08-01 20:20:38 MSD
как понимаю, Валерий взялся сопровождать, перевешиваю.
Comment 3 Valery Inozemtsev 2009-08-01 20:31:52 MSD
как воспроизвести?
Comment 4 viy 2009-08-01 20:46:15 MSD
с консоли:
[repocop@repocop ~]$ sqlite3 
SQLite version 3.6.16
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select substr('test',0,1);

sqlite> [repocop@repocop ~]$ 
[repocop@repocop ~]$
Comment 5 Valery Inozemtsev 2009-08-01 20:57:07 MSD
ты ничего не попутал?
sqlite> select substr('test',1,1);
t
sqlite>
Comment 6 viy 2009-08-01 21:05:23 MSD
нет, все верно.
песочница repocop.altlinux.org,
сегодня с утра dist-upgrade -ился,
и вот такое вылезло :(
присылай ключик, выдам ssh доступ.
Comment 7 Valery Inozemtsev 2009-08-01 21:11:24 MSD
sqlite> select substr('test',1,2);
te

нулевого символа там быть не может
Comment 8 Valery Inozemtsev 2009-08-01 21:14:29 MSD
sqlite> select substr('test',0,3);
te
Comment 9 Sir Raorn 2009-08-01 21:18:53 MSD
http://www.sqlite.org/lang_corefunc.html

substr(X,Y,Z), substr(X,Y)

Return a substring of input string X that begins with the Y-th character and which is Z characters long. If Z is omitted then all character through the end of the string are returned.
!!!!
> The left-most character of X is number 1.
!!!!
If Y is negative the the first character of the substring is found by counting from the right rather than the left. If X is string then characters indices refer to actual UTF-8 characters. If X is a BLOB then the indices refer to bytes.
Comment 10 viy 2009-08-01 21:22:18 MSD
О. спасибо!
значит, работает.
Сорри за беспокойство.