MDEV-13711 Assertion failure on CREATE TABLE .. LIKE <sequence>
Fixes two issues: - Update assert in open_and_process_tables to handle sequences - Removed not needed and conflicting mdl_context.release_transactional_locks in sql_sequence.cc. The MDL lock is released at end of mysql_execute_command(). Signed-off-by: Monty <monty@mariadb.org>
This commit is contained in:
parent
7447b4ce37
commit
7204f66c6a
@ -499,6 +499,27 @@ drop sequence t1;
|
|||||||
create table t1 (a int) engine=sql_sequence;
|
create table t1 (a int) engine=sql_sequence;
|
||||||
ERROR 42000: Unknown storage engine 'sql_sequence'
|
ERROR 42000: Unknown storage engine 'sql_sequence'
|
||||||
#
|
#
|
||||||
|
# MDEV-13711 assertion on CREATE LIKE fix
|
||||||
|
#
|
||||||
|
create sequence s;
|
||||||
|
create table t like s;
|
||||||
|
show create table t;
|
||||||
|
Table Create Table
|
||||||
|
t CREATE TABLE `t` (
|
||||||
|
`next_not_cached_value` bigint(21) NOT NULL,
|
||||||
|
`minimum_value` bigint(21) NOT NULL,
|
||||||
|
`maximum_value` bigint(21) NOT NULL,
|
||||||
|
`start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
|
||||||
|
`increment` bigint(21) NOT NULL COMMENT 'increment value',
|
||||||
|
`cache_size` bigint(21) unsigned NOT NULL,
|
||||||
|
`cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
|
||||||
|
`cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
|
||||||
|
) ENGINE=MyISAM SEQUENCE=1
|
||||||
|
show create sequence t;
|
||||||
|
Table Create Table
|
||||||
|
t CREATE SEQUENCE `t` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
|
||||||
|
drop tables t, s;
|
||||||
|
#
|
||||||
# MDEV-13714 SEQUENCE option fix
|
# MDEV-13714 SEQUENCE option fix
|
||||||
#
|
#
|
||||||
create or replace table s (
|
create or replace table s (
|
||||||
|
@ -376,6 +376,16 @@ drop sequence t1;
|
|||||||
--error ER_UNKNOWN_STORAGE_ENGINE
|
--error ER_UNKNOWN_STORAGE_ENGINE
|
||||||
create table t1 (a int) engine=sql_sequence;
|
create table t1 (a int) engine=sql_sequence;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-13711 assertion on CREATE LIKE fix
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
create sequence s;
|
||||||
|
create table t like s;
|
||||||
|
show create table t;
|
||||||
|
show create sequence t;
|
||||||
|
drop tables t, s;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # MDEV-13714 SEQUENCE option fix
|
--echo # MDEV-13714 SEQUENCE option fix
|
||||||
--echo #
|
--echo #
|
||||||
|
@ -3338,9 +3338,9 @@ open_and_process_table(THD *thd, LEX *lex, TABLE_LIST *tables,
|
|||||||
/*
|
/*
|
||||||
If this TABLE_LIST object has an associated open TABLE object
|
If this TABLE_LIST object has an associated open TABLE object
|
||||||
(TABLE_LIST::table is not NULL), that TABLE object must be a pre-opened
|
(TABLE_LIST::table is not NULL), that TABLE object must be a pre-opened
|
||||||
temporary table.
|
temporary table or SEQUENCE (see sequence_insert()).
|
||||||
*/
|
*/
|
||||||
DBUG_ASSERT(is_temporary_table(tables));
|
DBUG_ASSERT(is_temporary_table(tables) || tables->table->s->sequence);
|
||||||
}
|
}
|
||||||
else if (tables->open_type == OT_TEMPORARY_ONLY)
|
else if (tables->open_type == OT_TEMPORARY_ONLY)
|
||||||
{
|
{
|
||||||
|
@ -334,7 +334,6 @@ bool sequence_insert(THD *thd, LEX *lex, TABLE_LIST *table_list)
|
|||||||
trans_commit_implicit(thd);
|
trans_commit_implicit(thd);
|
||||||
if (!temporary_table)
|
if (!temporary_table)
|
||||||
close_thread_tables(thd);
|
close_thread_tables(thd);
|
||||||
thd->mdl_context.release_transactional_locks();
|
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user