Loading mysql-test/r/innodb.result +12 −0 Original line number Diff line number Diff line Loading @@ -2527,3 +2527,15 @@ SELECT * FROM t1; id 1 DROP TABLE t2, t1; CREATE TABLE t1 ( id INT PRIMARY KEY ) ENGINE=InnoDB; CREATE TEMPORARY TABLE t2 ( id INT NOT NULL PRIMARY KEY, b INT, FOREIGN KEY (b) REFERENCES test.t1(id) ) ENGINE=InnoDB; Got one of the listed errors DROP TABLE t1; mysql-test/t/innodb.test +15 −0 Original line number Diff line number Diff line Loading @@ -1451,3 +1451,18 @@ TRUNCATE t1; INSERT INTO t1 (id) VALUES (NULL); SELECT * FROM t1; DROP TABLE t2, t1; -- Test that foreign keys in temporary tables are not accepted (bug #12084) CREATE TABLE t1 ( id INT PRIMARY KEY ) ENGINE=InnoDB; --error 1005,1005 CREATE TEMPORARY TABLE t2 ( id INT NOT NULL PRIMARY KEY, b INT, FOREIGN KEY (b) REFERENCES test.t1(id) ) ENGINE=InnoDB; DROP TABLE t1; sql/ha_innodb.cc +21 −40 Original line number Diff line number Diff line Loading @@ -4689,13 +4689,7 @@ ha_innobase::create( form->s->row_type != ROW_TYPE_REDUNDANT); if (error) { innobase_commit_low(trx); row_mysql_unlock_data_dictionary(trx); trx_free_for_mysql(trx); DBUG_RETURN(error); goto cleanup; } /* Look for a primary key */ Loading @@ -4719,13 +4713,7 @@ ha_innobase::create( error = create_clustered_index_when_no_primary(trx, norm_name); if (error) { innobase_commit_low(trx); row_mysql_unlock_data_dictionary(trx); trx_free_for_mysql(trx); DBUG_RETURN(error); goto cleanup; } } Loading @@ -4734,13 +4722,7 @@ ha_innobase::create( first */ if ((error = create_index(trx, form, norm_name, (uint) primary_key_no))) { innobase_commit_low(trx); row_mysql_unlock_data_dictionary(trx); trx_free_for_mysql(trx); DBUG_RETURN(error); goto cleanup; } } Loading @@ -4749,14 +4731,7 @@ ha_innobase::create( if (i != (uint) primary_key_no) { if ((error = create_index(trx, form, norm_name, i))) { innobase_commit_low(trx); row_mysql_unlock_data_dictionary(trx); trx_free_for_mysql(trx); DBUG_RETURN(error); goto cleanup; } } } Loading @@ -4769,21 +4744,18 @@ ha_innobase::create( current_thd->query_length, current_thd->charset())) { error = HA_ERR_OUT_OF_MEM; } else { error = row_table_add_foreign_constraints(trx, q.str, norm_name); error = convert_error_code_to_mysql(error, NULL); goto cleanup; } if (error) { innobase_commit_low(trx); row_mysql_unlock_data_dictionary(trx); error = row_table_add_foreign_constraints(trx, q.str, norm_name, create_info->options & HA_LEX_CREATE_TMP_TABLE); trx_free_for_mysql(trx); error = convert_error_code_to_mysql(error, NULL); DBUG_RETURN(error); if (error) { goto cleanup; } } Loading Loading @@ -4823,6 +4795,15 @@ ha_innobase::create( trx_free_for_mysql(trx); DBUG_RETURN(0); cleanup: innobase_commit_low(trx); row_mysql_unlock_data_dictionary(trx); trx_free_for_mysql(trx); DBUG_RETURN(error); } /********************************************************************* Loading sql/share/errmsg.txt +1 −1 Original line number Diff line number Diff line Loading @@ -5495,7 +5495,7 @@ ER_COALESCE_ONLY_ON_HASH_PARTITION swe "COALESCE PARTITION kan bara anvndas p HASH/KEY partitioner" ER_ONLY_ON_RANGE_LIST_PARTITION eng "%s PARTITION can only be used on RANGE/LIST partitions" eng "%s PARTITION kan bara anvndas p RANGE/LIST partitioner" swe "%s PARTITION kan bara anvndas p RANGE/LIST-partitioner" ER_ADD_PARTITION_SUBPART_ERROR eng "Trying to Add partition(s) with wrong number of subpartitions" swe "ADD PARTITION med fel antal subpartitioner" Loading sql/sql_prepare.cc +1 −1 Original line number Diff line number Diff line Loading @@ -2686,11 +2686,11 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len) old_stmt_arena= thd->stmt_arena; thd->stmt_arena= this; lex_start(thd, (uchar*) thd->query, thd->query_length); lex->safe_to_cache_query= FALSE; lex->stmt_prepare_mode= TRUE; rc= yyparse((void *)thd) || thd->is_fatal_error || thd->net.report_error || init_param_array(this); lex->safe_to_cache_query= FALSE; /* While doing context analysis of the query (in check_prepared_statement) we allocate a lot of additional memory: for open tables, JOINs, derived Loading Loading
mysql-test/r/innodb.result +12 −0 Original line number Diff line number Diff line Loading @@ -2527,3 +2527,15 @@ SELECT * FROM t1; id 1 DROP TABLE t2, t1; CREATE TABLE t1 ( id INT PRIMARY KEY ) ENGINE=InnoDB; CREATE TEMPORARY TABLE t2 ( id INT NOT NULL PRIMARY KEY, b INT, FOREIGN KEY (b) REFERENCES test.t1(id) ) ENGINE=InnoDB; Got one of the listed errors DROP TABLE t1;
mysql-test/t/innodb.test +15 −0 Original line number Diff line number Diff line Loading @@ -1451,3 +1451,18 @@ TRUNCATE t1; INSERT INTO t1 (id) VALUES (NULL); SELECT * FROM t1; DROP TABLE t2, t1; -- Test that foreign keys in temporary tables are not accepted (bug #12084) CREATE TABLE t1 ( id INT PRIMARY KEY ) ENGINE=InnoDB; --error 1005,1005 CREATE TEMPORARY TABLE t2 ( id INT NOT NULL PRIMARY KEY, b INT, FOREIGN KEY (b) REFERENCES test.t1(id) ) ENGINE=InnoDB; DROP TABLE t1;
sql/ha_innodb.cc +21 −40 Original line number Diff line number Diff line Loading @@ -4689,13 +4689,7 @@ ha_innobase::create( form->s->row_type != ROW_TYPE_REDUNDANT); if (error) { innobase_commit_low(trx); row_mysql_unlock_data_dictionary(trx); trx_free_for_mysql(trx); DBUG_RETURN(error); goto cleanup; } /* Look for a primary key */ Loading @@ -4719,13 +4713,7 @@ ha_innobase::create( error = create_clustered_index_when_no_primary(trx, norm_name); if (error) { innobase_commit_low(trx); row_mysql_unlock_data_dictionary(trx); trx_free_for_mysql(trx); DBUG_RETURN(error); goto cleanup; } } Loading @@ -4734,13 +4722,7 @@ ha_innobase::create( first */ if ((error = create_index(trx, form, norm_name, (uint) primary_key_no))) { innobase_commit_low(trx); row_mysql_unlock_data_dictionary(trx); trx_free_for_mysql(trx); DBUG_RETURN(error); goto cleanup; } } Loading @@ -4749,14 +4731,7 @@ ha_innobase::create( if (i != (uint) primary_key_no) { if ((error = create_index(trx, form, norm_name, i))) { innobase_commit_low(trx); row_mysql_unlock_data_dictionary(trx); trx_free_for_mysql(trx); DBUG_RETURN(error); goto cleanup; } } } Loading @@ -4769,21 +4744,18 @@ ha_innobase::create( current_thd->query_length, current_thd->charset())) { error = HA_ERR_OUT_OF_MEM; } else { error = row_table_add_foreign_constraints(trx, q.str, norm_name); error = convert_error_code_to_mysql(error, NULL); goto cleanup; } if (error) { innobase_commit_low(trx); row_mysql_unlock_data_dictionary(trx); error = row_table_add_foreign_constraints(trx, q.str, norm_name, create_info->options & HA_LEX_CREATE_TMP_TABLE); trx_free_for_mysql(trx); error = convert_error_code_to_mysql(error, NULL); DBUG_RETURN(error); if (error) { goto cleanup; } } Loading Loading @@ -4823,6 +4795,15 @@ ha_innobase::create( trx_free_for_mysql(trx); DBUG_RETURN(0); cleanup: innobase_commit_low(trx); row_mysql_unlock_data_dictionary(trx); trx_free_for_mysql(trx); DBUG_RETURN(error); } /********************************************************************* Loading
sql/share/errmsg.txt +1 −1 Original line number Diff line number Diff line Loading @@ -5495,7 +5495,7 @@ ER_COALESCE_ONLY_ON_HASH_PARTITION swe "COALESCE PARTITION kan bara anvndas p HASH/KEY partitioner" ER_ONLY_ON_RANGE_LIST_PARTITION eng "%s PARTITION can only be used on RANGE/LIST partitions" eng "%s PARTITION kan bara anvndas p RANGE/LIST partitioner" swe "%s PARTITION kan bara anvndas p RANGE/LIST-partitioner" ER_ADD_PARTITION_SUBPART_ERROR eng "Trying to Add partition(s) with wrong number of subpartitions" swe "ADD PARTITION med fel antal subpartitioner" Loading
sql/sql_prepare.cc +1 −1 Original line number Diff line number Diff line Loading @@ -2686,11 +2686,11 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len) old_stmt_arena= thd->stmt_arena; thd->stmt_arena= this; lex_start(thd, (uchar*) thd->query, thd->query_length); lex->safe_to_cache_query= FALSE; lex->stmt_prepare_mode= TRUE; rc= yyparse((void *)thd) || thd->is_fatal_error || thd->net.report_error || init_param_array(this); lex->safe_to_cache_query= FALSE; /* While doing context analysis of the query (in check_prepared_statement) we allocate a lot of additional memory: for open tables, JOINs, derived Loading