Bug #38733 | Stored procedure using rlike against a null-valued parameter hangs | ||
---|---|---|---|
Submitted: | 12 Aug 2008 1:15 | Modified: | 10 Sep 2008 14:02 |
Reporter: | Dave Shifflett | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server: Stored Routines | Severity: | S2 (Serious) |
Version: | 5.0.67 | OS: | Windows (Linux) |
Assigned to: | Georgi Kodinov | CPU Architecture: | Any |
Tags: | hang, null, regression, RLIKE, Store Procedure, variable |
[12 Aug 2008 1:15]
Dave Shifflett
[12 Aug 2008 1:18]
Dave Shifflett
SQL Script to Create Database and Trigger Bug
Attachment: rlike-reproduction.sql (application/octet-stream, text), 924 bytes.
[12 Aug 2008 1:37]
MySQL Verification Team
Verified on Windows XP. I will test with Linux: C:\dbs>c:\dbs\5.0\bin\mysql -uroot --port=3500 --prompt="mysql 5.0 > " Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.0.68-nt-debug-log Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql 5.0 > create database dg; Query OK, 1 row affected (0.00 sec) mysql 5.0 > use dg Database changed mysql 5.0 > create table entContact( -> id int unsigned NOT NULL auto_increment, -> person varchar(32) NOT NULL, -> primary key(id) -> ); Query OK, 0 rows affected (0.14 sec) mysql 5.0 > mysql 5.0 > insert into entContact(person) values('Joe'), ('Jessica'), ('Alan'); Query OK, 3 rows affected (0.05 sec) Records: 3 Duplicates: 0 Warnings: 0 mysql 5.0 > delimiter $$ mysql 5.0 > create procedure lstContacts(pPersonMatch varchar(64)) -> begin -> select * from entContact -> where pPersonMatch is null or person rlike pPersonMatch; -> end$$ Query OK, 0 rows affected (0.11 sec) mysql 5.0 > delimiter ; mysql 5.0 > -- Either of these successfully return Joe. mysql 5.0 > call lstContacts('Joe(seph)?'); +----+--------+ | id | person | +----+--------+ | 1 | Joe | +----+--------+ 1 row in set (0.05 sec) Query OK, 0 rows affected (0.05 sec) mysql 5.0 > select * from entContact where person rlike 'Joe(seph)?'; +----+--------+ | id | person | +----+--------+ | 1 | Joe | +----+--------+ 1 row in set (0.00 sec) mysql 5.0 > -- Any of these successfully return an empty set. mysql 5.0 > call lstContacts('Sarah?'); Empty set (0.00 sec) Query OK, 0 rows affected (0.00 sec) mysql 5.0 > select * from entContact where person rlike 'Sarah?'; Empty set (0.00 sec) mysql 5.0 > select * from entContact where person rlike null; Empty set (0.00 sec) mysql 5.0 > mysql 5.0 > -- Successfully returns all Joe, Jessica, and Alan. mysql 5.0 > select * from entContact where null is null or person rlike null; +----+---------+ | id | person | +----+---------+ | 1 | Joe | | 2 | Jessica | | 3 | Alan | +----+---------+ 3 rows in set (0.00 sec) mysql 5.0 > mysql 5.0 > -- This one hangs, but should return the same thing as the previous statement. mysql 5.0 > call lstContacts(null); Query aborted by Ctrl+C ^CDeseja interromper o arquivo em lotes (S/N)? s
[14 Aug 2008 12:47]
MySQL Verification Team
Thank you for the bug report. Not repeatable on 5.1.
[10 Sep 2008 13:58]
Georgi Kodinov
Possibly a duplicate of bug #39021
[10 Sep 2008 14:02]
Georgi Kodinov
Confirmed : fixed by the fix for bug #39021