Bug #19055 Partitions: crash when key(varchar_column) and search
Submitted: 12 Apr 2006 18:41 Modified: 10 Jun 2006 5:49
Reporter: Peter Gulutzan
Status: Closed
Category:Server: Partition Severity:S3 (Non-critical)
Version:5.1.10-beta-debug OS:Linux (SUSE 10.0)
Assigned to: Bugs System Target Version:

[12 Apr 2006 18:41] Peter Gulutzan
Description:
I create a table with a partition by key with a
CHAR/VARCHAR column. I try an ORed search on the 
(empty) table. Crash.

See also:
Bug#17946 Partitions: key() can be for a character column

How to repeat:
mysql> create table tzz (s1 varchar(15)) partition by key (s1);
Query OK, 0 rows affected (0.10 sec)

mysql> select * from tzz where s1 = 0 or s1 is null;
ERROR 2013 (HY000): Lost connection to MySQL server during query
[12 Apr 2006 19:51] Miguel Solorzano
Thank you for the bug report.

060412 14:53:09 [Note] /home/miguel/dbs/5.1/libexec/mysqld: ready for connections.
Version: '5.1.10-beta-debug'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
[New Thread 1119902640 (LWP 6393)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1119902640 (LWP 6393)]
0x082e417d in find_used_partitions (ppar=0x42c042e4, key_tree=0x0) at opt_range.cc:2702
2702      int partno= (int)key_tree->part;
(gdb)
[26 May 2006 16:50] Peter Gulutzan
See also: bug#20086 Can't get data from key partitioned tables with VARCHAR key
[4 Jun 2006 13:56] Sergey Petrunya
The crash doesn't occur if one makes 0 a string constant:

mysql> select * from tzz where s1 = '0' or s1 is null;
Empty set (1.16 sec)
[4 Jun 2006 15:08] Bugs System
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/7247
[9 Jun 2006 22:22] Sergey Petrunya
The fix has been pushed into 5.1.12 tree.
Notes for the changelog:
The bug was that mysqld would crash when one tries to execute queries with WHERE clauses
in form 
"tbl.partitioning_integer_field = 'some-character-string' OR
  some-sargable-condition(partitioning_integer_field)" 
where table tbl is partitioned, and [sub]partitioning function uses
partitioning_integer_field.
[10 Jun 2006 5: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 bugfix in 5.1.12 changelog. Closed.