[MDEV-13714] Value of SEQUENCE table option is ignored upon creation Created: 2017-09-02  Updated: 2018-08-31  Resolved: 2017-10-22

Status: Closed
Project: MariaDB Server
Component/s: Sequences
Affects Version/s: 10.3
Fix Version/s: 10.3.3

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Michael Widenius
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
PartOf
is part of MDEV-10139 Support for SEQUENCE objects Closed
Relates
relates to MDEV-13016 Testing SEQUENCE object phase 2 Closed

 Description   

No matter which value the SEQUENCE option has, as long as it's present, the table is created as a sequence:

Test case

CREATE TABLE `s` (
  `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,
  `increment` bigint(21) NOT NULL,
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL,
  `cycle_count` bigint(21) NOT NULL
) SEQUENCE=0;
 
SHOW CREATE TABLE s;
SHOW CREATE SEQUENCE s;
 
# Cleanup
DROP TABLE s;

Actual result

MariaDB [test]> SHOW CREATE TABLE s \G
*************************** 1. row ***************************
       Table: s
Create Table: CREATE TABLE `s` (
  `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,
  `increment` bigint(21) NOT NULL,
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL,
  `cycle_count` bigint(21) NOT NULL
) ENGINE=InnoDB SEQUENCE=1
1 row in set (0.00 sec)

MariaDB [test]> SHOW CREATE SEQUENCE s \G
*************************** 1. row ***************************
       Table: s
Create Table: CREATE SEQUENCE `s` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB
1 row in set (0.00 sec)



 Comments   
Comment by Aleksey Midenkov [ 2017-10-13 ]

Now it's reproduced with:

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)
SEQUENCE=0;

Comment by Michael Widenius [ 2017-10-22 ]

CREATE TABLE ... sequence=0 and sequence=DEFAULT created sequence tables when they should not.

Pushed into bb-10.2-ext, which will be shortly merged into 10.3

Fix provided by Aleksey Midenkov

Generated at Thu Feb 08 08:07:47 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.