Bug #17136 Partitions: crash if values in (variable)
Submitted: 5 Feb 2006 16:47 Modified: 6 Jun 2006 12:18
Reporter: Peter Gulutzan Email Updates:
Status: Duplicate Impact on me:
Category:MySQL Server: Partitions Severity:S1 (Critical)
Version:5.1.7-beta-debug OS:Linux (SUSE 10.0)
Assigned to: Mikael Ronström CPU Architecture:Any

[5 Feb 2006 16:47] Peter Gulutzan
I create a partitioned table.
I try to alter it in a procedure, with a clause "IN (v)",
where v is a variable name.

How to repeat:
mysql> delimiter //
mysql> create table txn (s1 int) partition by list (s1) (partition p1 values in (1))//
Query OK, 0 rows affected (0.11 sec)

mysql> create procedure pn () begin declare v int default 0; alter table txn add partition (partition p4 values in (v)); end//
ERROR 2013 (HY000): Lost connection to MySQL server during query
[5 Feb 2006 17:07] Miguel Solorzano
[New Thread 1099586480 (LWP 5137)]
060205 15:04:46 [Note] /home/miguel/dbs/5.1/libexec/mysqld: ready for connections.
Version: '5.1.7-beta-debug'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
[New Thread 1119861680 (LWP 5166)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1119861680 (LWP 5166)]
0x0817310a in Item_splocal::this_item (this=0x92208e8) at item.cc:915
915       DBUG_ASSERT(m_sp == m_thd->spcont->sp);
(gdb) bt full
#0  0x0817310a in Item_splocal::this_item (this=0x92208e8) at item.cc:915
        __PRETTY_FUNCTION__ = "virtual Item* Item_splocal::this_item()"
#1  0x08172d0c in Item_sp_variable::fix_fields (this=0x92208e8, thd=0x9203df8) at item.cc:808
        it = (Item *) 0x42bf9f38
        __PRETTY_FUNCTION__ = "virtual bool Item_sp_variable::fix_fields(THD*, Item**)"
#2  0x0823a06e in yyparse (yythd=0x9203df8) at sql_yacc.yy:3813
        part_expr = (class Item *) 0x92208e8
        not_corr_func = 66
        lex = (LEX *) 0x91f6578
        context = (Name_resolution_context *) 0x91f67e4
        thd = (class THD *) 0x9203df8
        item_value = 1
        save_list = (TABLE_LIST *) 0x0
        save_where = 0x86c8da0 "field list"
        yystate = 4041
        yytoken = 603
[13 Mar 2006 18:32] Reggie Burnett
This and all other bugs related to allowing expressions as partition functions are being closed as "won't fix" and replaced with Bug #18198  	Expressions are allowed as partition functions.
[31 May 2006 10:12] Mikael Ronström
Resurrected this bug since it isn't fixed by the fix for BUG #18198
[31 May 2006 12:45] Mikael Ronström
The call to fix_fields must be postponed until after the parser phase and into the
execution phase. Might be a bit tricky to fix.
[6 Jun 2006 12:18] Mikael Ronström
This bug is dependent on the same solution to the bug 18198 so I'll mark this as
duplicate and add the test case of this one to the solution for 18198
Bug 18198 also needs fix_fields to move out of parser but also needs to
check item tree before calling fix_fields that it is a valid item tree.