Bug #14713 | SP for caseinsensitive stringcomparison doesn't work | ||
---|---|---|---|
Submitted: | 7 Nov 2005 17:25 | Modified: | 16 Nov 2005 20:07 |
Reporter: | Oliver Peters | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server: Stored Routines | Severity: | S2 (Serious) |
Version: | 5.0.17-BK, 5.0.15 | OS: | Linux (Linux, Windows2000) |
Assigned to: | CPU Architecture: | Any |
[7 Nov 2005 17:25]
Oliver Peters
[8 Nov 2005 7:29]
Oliver Peters
maybe a helpful addition: Doing this query SELECT * ,fcschnitt(Nameold,3,Namenew), LOCATE('mei',Nameold,1) FROM strcomp I get this result 1, 'MEIER', 'MEIER', 3, 1 2, 'meier', 'meier', 3, 1 3, 'MEIER', 'meier', 0, 1 4, 'meier', 'MEIER', 0, 1 In the column where I only use LOCATE in every line I get a hit - for the SP I only get hits for the cases with "total" equality and that's what I assume is an error
[10 Nov 2005 15:17]
Valeriy Kravchuk
Thank you for a bug report. I was able to verify it just as you described on 5.0.17-BK (ChangeSet@1.1957, 2005-11-09 20:31:01+03:00, ...) on Linux. But I had also created a simpler test function to demonstrate the bug on your table: mysql> CREATE TABLE `strcomp` ( -> `id` smallint(5) unsigned NOT NULL auto_increment, -> `Nameold` varchar(45) NOT NULL default '', -> `Namenew` varchar(45) NOT NULL default '', -> PRIMARY KEY (`id`) -> ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED; Query OK, 0 rows affected (0,06 sec) mysql> INSERT INTO `strcomp` VALUES -> (1,'MEIER','MEIER'),(2,'meier','meier'),(3,'MEIER','meier'),(4,'meier','MEIER'); Query OK, 4 rows affected (0,01 sec) Records: 4 Duplicates: 0 Warnings: 0 mysql> create function f2(oldn char(100), newn char(100)) returns int return LOCATE(oldn, newn, 1); Query OK, 0 rows affected (0,00 sec) mysql> SELECT * , f2(Nameold,Namenew) as f2, LOCATE(Nameold,Namenew, 1) as l FROM strcomp; +----+---------+---------+------+---+ | id | Nameold | Namenew | f2 | l | +----+---------+---------+------+---+ | 1 | MEIER | MEIER | 1 | 1 | | 2 | meier | meier | 1 | 1 | | 3 | MEIER | meier | 0 | 1 | | 4 | meier | MEIER | 0 | 1 | +----+---------+---------+------+---+ 4 rows in set (0,01 sec) mysql> select version(); +-----------+ | version() | +-----------+ | 5.0.17 | +-----------+ 1 row in set (0,00 sec) So, LOCATE really works differently with function parameters than with column values...
[10 Nov 2005 17:05]
Oliver Peters
ok, here is another supplement: CREATE FUNCTION `test`.`f3`(oldn char(100), newn char(100)) RETURNS int return INSTR(oldn, newn); mysql> SELECT *, f3(Nameold,Namenew) as f3, INSTR(Nameold,Namenew) l -> FROM strcomp; +----+---------+---------+------+---+ | id | Nameold | Namenew | f3 | l | +----+---------+---------+------+---+ | 1 | MEIER | MEIER | 1 | 1 | | 2 | meier | meier | 1 | 1 | | 3 | MEIER | meier | 0 | 1 | | 4 | meier | MEIER | 0 | 1 | +----+---------+---------+------+---+ 4 rows in set (0.00 sec) So, it's the same problem with the function INSTR
[16 Nov 2005 20:07]
Sergei Golubchik
Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Because of this, we hope you add your comments to the original bug instead. Thank you for your interest in MySQL. Additional info: see BUG#12903