Bug #18053 Partitions: crash if null
Submitted: 8 Mar 2006 0:00 Modified: 29 Mar 2006 7:49
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Partitions Severity:S3 (Non-critical)
Version:5.1.8-beta-debug OS:Linux (SUSE 10.0)
Assigned to: Sergey Glukhov CPU Architecture:Any

[8 Mar 2006 0:00] Peter Gulutzan
Description:
I create a list-partitioned table with a NULL partition.
I insert. I select. Crash.

How to repeat:
mysql> create table t3 (s1 smallint) partition by list (s1) (partition p0 values in (null));
Query OK, 0 rows affected (0.01 sec)

mysql> insert into t3 values (null);
Query OK, 1 row affected (0.01 sec)

mysql> select * from t3 where s1 is null;
ERROR 2013 (HY000): Lost connection to MySQL server during query
[8 Mar 2006 1:23] Miguel Solorzano
Thank you for the bug report.

[New Thread 1099586480 (LWP 12931)]
060307 22:44:58 [Note] /home/miguel/dbs/5.1/libexec/mysqld: ready for connections.
Version: '5.1.8-beta-debug'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
[New Thread 1119861680 (LWP 12952)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1119861680 (LWP 12952)]
0x0816d67b in get_list_array_idx_for_endpoint (part_info=0x92070e0, left_endpoint=true, include_endpoint=true) at sql_partition.cc:2743
2743        list_value= list_array[list_index].list_value;
(gdb)
[14 Mar 2006 8:15] Jim Winstead
i don't get a crash, but it looks like partition pruning does not work with partitions on NULL. here's my test case:

create table t1 (s1 smallint) partition by list (s1) (partition p1 values in (1), partition p0 values in (null));
insert into t1 values (null),(1),(null),(1);
select * from t1;
select count(*) from t1 where s1 is null;
select count(*) from t1 where s1 is not null;
explain select count(*) from t1 where s1 is null;
explain select count(*) from t1 where s1 is not null;
drop table t1;
[14 Mar 2006 14:39] Sergey Glukhov
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/3829
[21 Mar 2006 10:45] Sergey Petrunya
First review comments provided on irc
[23 Mar 2006 10:47] Sergey Glukhov
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/4061
[27 Mar 2006 13:56] Sergey Glukhov
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/4194
[28 Mar 2006 12:33] Sergey Glukhov
Fixed in 5.1.9
[29 Mar 2006 7:49] Jon Stephens
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

Documented in 5.1.9 changelog. Closed.