Commit 7447b4ce authored by Aleksey Midenkov's avatar Aleksey Midenkov Committed by Monty

MDEV-13714 Value of SEQUENCE table option is ignored upon creation

CREATE TABLE ... sequence=0 and sequence=DEFAULT created sequence tables
when they should not.
Signed-off-by: default avatarMonty <monty@mariadb.org>
parent f64cff92
......@@ -498,3 +498,55 @@ previous value for t1
drop sequence t1;
create table t1 (a int) engine=sql_sequence;
ERROR 42000: Unknown storage engine 'sql_sequence'
#
# MDEV-13714 SEQUENCE option fix
#
create or replace table s (
`next_value` bigint(21) not null,
`min_value` bigint(21) not null,
`max_value` bigint(21) not null,
`start` bigint(21) not null,
`increment` bigint(21) not null,
`cache` bigint(21) not null,
`cycle` tinyint(1) unsigned not null,
`round` bigint(21) not null)
sequence=0;
create or replace table s2 (
`next_value` bigint(21) not null,
`min_value` bigint(21) not null,
`max_value` bigint(21) not null,
`start` bigint(21) not null,
`increment` bigint(21) not null,
`cache` bigint(21) not null,
`cycle` tinyint(1) unsigned not null,
`round` bigint(21) not null)
sequence=default;
show create table s;
Table Create Table
s CREATE TABLE `s` (
`next_value` bigint(21) NOT NULL,
`min_value` bigint(21) NOT NULL,
`max_value` bigint(21) NOT NULL,
`start` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
`cache` bigint(21) NOT NULL,
`cycle` tinyint(1) unsigned NOT NULL,
`round` bigint(21) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create table s2;
Table Create Table
s2 CREATE TABLE `s2` (
`next_value` bigint(21) NOT NULL,
`min_value` bigint(21) NOT NULL,
`max_value` bigint(21) NOT NULL,
`start` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
`cache` bigint(21) NOT NULL,
`cycle` tinyint(1) unsigned NOT NULL,
`round` bigint(21) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create sequence s;
ERROR 42S02: 'test.s' is not a SEQUENCE
show create sequence s2;
ERROR 42S02: 'test.s2' is not a SEQUENCE
drop table s,s2;
......@@ -375,3 +375,37 @@ drop sequence t1;
--error ER_UNKNOWN_STORAGE_ENGINE
create table t1 (a int) engine=sql_sequence;
--echo #
--echo # MDEV-13714 SEQUENCE option fix
--echo #
create or replace table s (
`next_value` bigint(21) not null,
`min_value` bigint(21) not null,
`max_value` bigint(21) not null,
`start` bigint(21) not null,
`increment` bigint(21) not null,
`cache` bigint(21) not null,
`cycle` tinyint(1) unsigned not null,
`round` bigint(21) not null)
sequence=0;
create or replace table s2 (
`next_value` bigint(21) not null,
`min_value` bigint(21) not null,
`max_value` bigint(21) not null,
`start` bigint(21) not null,
`increment` bigint(21) not null,
`cache` bigint(21) not null,
`cycle` tinyint(1) unsigned not null,
`round` bigint(21) not null)
sequence=default;
show create table s;
show create table s2;
--error ER_NOT_SEQUENCE
show create sequence s;
--error ER_NOT_SEQUENCE
show create sequence s2;
drop table s,s2;
......@@ -5904,7 +5904,7 @@ create_table_option:
| SEQUENCE_SYM opt_equal choice
{
Lex->create_info.used_fields|= HA_CREATE_USED_SEQUENCE;
Lex->create_info.sequence= $3;
Lex->create_info.sequence= ($3 == HA_CHOICE_YES);
}
;
......
......@@ -5776,7 +5776,7 @@ create_table_option:
| SEQUENCE_SYM opt_equal choice
{
Lex->create_info.used_fields|= HA_CREATE_USED_SEQUENCE;
Lex->create_info.sequence= $3;
Lex->create_info.sequence= ($3 == HA_CHOICE_YES);
}
;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment