Details
-
Type:
Bug
-
Status: Closed
-
Resolution: Not a Bug
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:
Description
mysqld will crash when one tries to create a table with virtual column that uses stored function.
== How to repeat ==
mysql> delimiter //
mysql> create function f1(a int) returns int begin return a+1; end //
Query OK, 0 rows affected (0.04 sec)
mysql> delimiter ;
mysql> create table tv1 (a int, b int as (f1(a)) persistent);
ERROR 2013 (HY000): Lost connection to MySQL server during query
== Crash details ==
mysqld: field.cc:9611: bool Create_field::init(THD*, char*, enum_field_types, char*, char*, uint, Item*, Item*, LEX_STRING*, char*, List<String>, const CHARSET_INFO, uint, Virtual_column_info*): Assertion `vcol_info && vcol_info->expr_item' failed.
Program received signal SIGABRT, Aborted.
[Switching to Thread 0x9e921bb0 (LWP 8264)]
0xb7d51947 in raise () from /lib/tls/libc.so.6
(gdb) wher
#0 0xb7d51947 in raise () from /lib/tls/libc.so.6
#1 0xb7d530c9 in abort () from /lib/tls/libc.so.6
#2 0xb7d4b05f in __assert_fail () from /lib/tls/libc.so.6
#3 0x0823a734 in Create_field::init (this=0x9db3730, thd=0x9cc7588, fld_name=0x9db2bb0 "b", fld_type=245, fld_length=0x0, fld_decimals=0x0, fld_type_modifier=0, fld_default_value=0x0, fld_on_update_value=0x0, fld_comment=0x9cc905c, fld_change=0x0, fld_interval_list=0x9cc910c, fld_charset=0x0, fld_geom_type=2779096485, fld_vcol_info=0x9db3710) at field.cc:9611
#4 0x0827db2a in add_field_to_list (thd=0x9cc7588, field_name=0x9e91f944, type=245, length=0x0, decimals=0x0, type_modifier=0, default_value=0x0, on_update_value=0x0, comment=0x9cc905c, change=0x0, interval_list=0x9cc910c, cs=0x0, uint_geom_type=2779096485, vcol_info=0x9db3710) at sql_parse.cc:6243
#5 0x082a9749 in MYSQLparse (yythd=0x9cc7588) at sql_yacc.yy:4957
#6 0x0827a5be in parse_sql (thd=0x9cc7588, parser_state=0x9e920cb0, creation_ctx=0x0) at sql_parse.cc:7998
#7 0x0828baf7 in mysql_parse (thd=0x9cc7588, inBuf=0x9db2850 "create table tv1 (a int, b int as (f1(a)) persistent)", length=53, found_semicolon=0x9e921300) at sql_parse.cc:6042
#8 0x0828cbdd in dispatch_command (command=COM_QUERY, thd=0x9cc7588, packet=0x9d9ab41 "create table tv1 (a int, b int as (f1(a)) persistent)", packet_length=53) at sql_parse.cc:1253
#9 0x0828df3e in do_command (thd=0x9cc7588) at sql_parse.cc:891
#10 0x08278cf6 in handle_one_connection (arg=0x9cc7588) at sql_connect.cc:1599
#11 0xb7edf0bd in start_thread () from /lib/tls/libpthread.so.0
#12 0xb7df49ee in clone () from /lib/tls/libc.so.6
(gdb) up
#1 0xb7d530c9 in abort () from /lib/tls/libc.so.6
(gdb) up
#2 0xb7d4b05f in __assert_fail () from /lib/tls/libc.so.6
(gdb) up
#3 0x0823a734 in Create_field::init (this=0x9db3730, thd=0x9cc7588, fld_name=0x9db2bb0 "b", fld_type=245, fld_length=0x0, fld_decimals=0x0, fld_type_modifier=0, fld_default_value=0x0, fld_on_update_value=0x0, fld_comment=0x9cc905c, fld_change=0x0, fld_interval_list=0x9cc910c, fld_charset=0x0, fld_geom_type=2779096485, fld_vcol_info=0x9db3710) at field.cc:9611
(gdb) list
9606 stored_in_db= TRUE;
9607
9608 /* Initialize data for a computed field */
9609 if ((uchar)fld_type == (uchar)MYSQL_TYPE_VIRTUAL)
9610 {
9611 DBUG_ASSERT(vcol_info && vcol_info->expr_item);
9612 vcol_info= fld_vcol_info;
9613 stored_in_db= vcol_info->is_stored();
9614 /*
9615 Walk through the Item tree checking if all items are valid
(gdb) print vcol_info
$1 = (Virtual_column_info *) 0xa5a5a5a5
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
Re: Crash when virtual column uses stored function
I can see the following "problematic" queries.
1. subquery expressions
2. references to user/system variables
3. items that evaluate differently depending on current charset, collation,
timezone, sql_mode setting, etc.
AFAIR, partitioning code solves the problem by disallowing #1 and #2, and using
some pre-defined parameters for #3 (need to check the last part).
VIEW definitions allow #1 but disallow #2. For #3, it seems that @@character_set_client and
@@collation_connection are saved together with the VIEW definition.