Bug #51347 assertion with show create table + partition by columns on decimal column
Submitted: 20 Feb 2010 13:56 Modified: 29 Mar 2010 9:45
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Partitions Severity:S1 (Critical)
Version:5.5.1-m2-debug,5.5.99-m3-debug OS:Any
Assigned to: Mattias Jonsson CPU Architecture:Any
Triage: Triaged: D1 (Critical)

[20 Feb 2010 13:56] Shane Bester
Description:
Version: '5.5.1-m2-community-debug'  socket: ''  port: 3306  MySQL Community Server - Debug (GPL)
Assertion failed: result_type == field->result_type(), file .\sql_partition.cc, line 2242

mysqld-debug.exe!my_sigabrt_handler()[my_thr_init.c:433]
mysqld-debug.exe!raise()[winsig.c:590]
mysqld-debug.exe!abort()[abort.c:71]
mysqld-debug.exe!_wassert()[assert.c:212]
mysqld-debug.exe!add_column_list_values()[sql_partition.cc:2242]
mysqld-debug.exe!add_partition_values()[sql_partition.cc:2299]
mysqld-debug.exe!generate_partition_syntax()[sql_partition.cc:2523]
mysqld-debug.exe!store_create_info()[sql_show.cc:1498]
mysqld-debug.exe!mysqld_show_create()[sql_show.cc:664]
mysqld-debug.exe!mysql_execute_command()[sql_parse.cc:3068]
mysqld-debug.exe!mysql_parse()[sql_parse.cc:6211]
mysqld-debug.exe!dispatch_command()[sql_parse.cc:1240]
mysqld-debug.exe!do_command()[sql_parse.cc:873]
mysqld-debug.exe!handle_one_connection()[sql_connect.cc:1154]
mysqld-debug.exe!pthread_start()[my_winthread.c:61]
mysqld-debug.exe!_callthreadstartex()[threadex.c:348]
mysqld-debug.exe!_threadstartex()[threadex.c:331]
kernel32.dll!FlsSetValue()

How to repeat:
on debug build run this:

drop table if exists `t1`;
create table `t1`(`a` dec) engine=myisam
partition by range columns (`a`)
(partition `p` values less than (0) engine = myisam);
show create table `t1`;
[20 Feb 2010 14:54] Valeriy Kravchuk
Thank you for the bug report. Verified just as described on Mac OS X:

77-52-24-143:trunk openxs$ bin/mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.1-m2-debug Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> drop table if exists `t1`;
Query OK, 0 rows affected (0.03 sec)

mysql> create table `t1`(`a` dec) engine=myisam
    -> partition by range columns (`a`)
    -> (partition `p` values less than (0) engine = myisam);
Query OK, 0 rows affected (0.25 sec)

mysql> show create table `t1`;
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql> 100220 16:52:40 mysqld_safe mysqld restarted

In the error log I've got:

...
Version: '5.5.1-m2-debug'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
Assertion failed: (result_type == field->result_type()), function unknown function, file sql_partition.cc, line 2242.
...
[4 Mar 2010 9:36] Mattias Jonsson
In the manual:
http://dev.mysql.com/doc/refman/5.5/en/partitioning-columns.html

it says:
Other numeric data types (such as DECIMAL or FLOAT) are not supported as partitioning columns. 

So the bug is probably that DECIMAL is allowed in the create in the first place.
(the code tries to handle DECIMAL as if it is a INTEGER type, which is not really true...)
[4 Mar 2010 10:25] 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/102268

3123 Mattias Jonsson	2010-03-04
      Bug#51347: assertion with show create table + partition by columns
      on decimal column
      
      The problem was that there was no check to disallow DECIMAL
      columns in the code (it was accepted as if it was INTEGER).
      
      Solution was to correctly disallow DECIMAL columns in
      COLUMNS partitioning. As documented.
     @ mysql-test/r/partition_column.result
        Bug#51347: assertion with show create table + partition by columns
        on decimal column
        
        updated test result
     @ mysql-test/t/partition_column.test
        Bug#51347: assertion with show create table + partition by columns
        on decimal column
        
        Added test to verify column types that is not supported
     @ sql/sql_partition.cc
        Bug#51347: assertion with show create table + partition by columns
        on decimal column
        
        Moved DECIMAL types to be disallowed as column types in COLUMNS
        partitioning
[11 Mar 2010 9:27] Mikael Ronström
Please create WL for adding support for Decimal type
[16 Mar 2010 21:10] Mattias Jonsson
pushed to mysql-trunk-bugfixing and mysql-next-mr-bugfixing (not yet to mysql-6.0-codebase-bugfixing, due to unmerged csets)
[24 Mar 2010 8:14] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100324081249-yfwol7qtcek6dh7w) (version source revid:alik@sun.com-20100324081113-kc7x1iytnplww91u) (merge vers: 6.0.14-alpha) (pib:16)
[24 Mar 2010 8:16] Bugs System
Pushed into 5.5.4-m3 (revid:alik@sun.com-20100324081056-6bndv6f0nrvbblhp) (version source revid:alik@sun.com-20100324081056-6bndv6f0nrvbblhp) (merge vers: 5.5.4-m3) (pib:16)
[24 Mar 2010 8:17] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100324081159-5b8juv8ldiqwce8v) (version source revid:alik@sun.com-20100324081105-y72rautcea375zxm) (pib:16)
[29 Mar 2010 9:45] Jon Stephens
Documented in the 5.5.4 and 6.0.14 changelogs as follows:

        Attempting to partition a table using a DECIMAL column caused
        the server to crash; this not supported and is now specifically
        disallowed.

Closed.
[31 Mar 2010 16:01] Paul Dubois
5.5.4 changelog entry was moved to 5.5.5.