mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 02:30:06 +01:00
17a87d6063
Working features: CREATE OR REPLACE [TEMPORARY] SEQUENCE [IF NOT EXISTS] name [ INCREMENT [ BY | = ] increment ] [ MINVALUE [=] minvalue | NO MINVALUE ] [ MAXVALUE [=] maxvalue | NO MAXVALUE ] [ START [ WITH | = ] start ] [ CACHE [=] cache ] [ [ NO ] CYCLE ] ENGINE=xxx COMMENT=".." SELECT NEXT VALUE FOR sequence_name; SELECT NEXTVAL(sequence_name); SELECT PREVIOUS VALUE FOR sequence_name; SELECT LASTVAL(sequence_name); SHOW CREATE SEQUENCE sequence_name; SHOW CREATE TABLE sequence_name; CREATE TABLE sequence-structure ... SEQUENCE=1 ALTER TABLE sequence RENAME TO sequence2; RENAME TABLE sequence TO sequence2; DROP [TEMPORARY] SEQUENCE [IF EXISTS] sequence_names Missing features - SETVAL(value,sequence_name), to be used with replication. - Check replication, including checking that sequence tables are marked not transactional. - Check that a commit happens for NEXT VALUE that changes table data (may already work) - ALTER SEQUENCE. ANSI SQL version of setval. - Share identical sequence entries to not add things twice to table list. - testing insert/delete/update/truncate/load data - Run and fix Alibaba sequence tests (part of mysql-test/suite/sql_sequence) - Write documentation for NEXT VALUE / PREVIOUS_VALUE - NEXTVAL in DEFAULT - Ensure that NEXTVAL in DEFAULT uses database from base table - Two NEXTVAL for same row should give same answer. - Oracle syntax sequence_table.nextval, without any FOR or FROM. - Sequence tables are treated as 'not read constant tables' by SELECT; Would be better if we would have a separate list for sequence tables so that select doesn't know about them, except if refereed to with FROM. Other things done: - Improved output for safemalloc backtrack - frm_type_enum changed to Table_type - Removed lex->is_view and replaced with lex->table_type. This allows use to more easy check if item is view, sequence or table. - Added table flag HA_CAN_TABLES_WITHOUT_ROLLBACK, needed for handlers that want's to support sequences - Added handler calls: - engine_name(), to simplify getting engine name for partition and sequences - update_first_row(), to be able to do efficient sequence implementations. - Made binlog_log_row() global to be able to call it from ha_sequence.cc - Added handler variable: row_already_logged, to be able to flag that the changed row is already logging to replication log. - Added CF_DB_CHANGE and CF_SCHEMA_CHANGE flags to simplify deny_updates_if_read_only_option() - Added sp_add_cfetch() to avoid new conflicts in sql_yacc.yy - Moved code for add_table_options() out from sql_show.cc::show_create_table() - Added String::append_longlong() and used it in sql_show.cc to simplify code. - Added extra option to dd_frm_type() and ha_table_exists to indicate if the table is a sequence. Needed by DROP SQUENCE to not drop a table.
497 lines
19 KiB
Text
497 lines
19 KiB
Text
drop table if exists t1;
|
|
Warnings:
|
|
Note 1051 Unknown table 'test.t1'
|
|
create or replace sequence t1 engine=myisam;
|
|
show create sequence t1;
|
|
Table Create Table
|
|
t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
|
|
show create table t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
|
|
`min_value` bigint(21) NOT NULL COMMENT 'min value',
|
|
`max_value` bigint(21) NOT NULL COMMENT 'max value',
|
|
`start` bigint(21) NOT NULL COMMENT 'start value',
|
|
`increment` bigint(21) NOT NULL COMMENT 'increment value',
|
|
`cache` bigint(21) NOT NULL COMMENT 'cache size',
|
|
`cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
|
|
`round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
|
|
) ENGINE=MyISAM SEQUENCE=1
|
|
select * from t1;
|
|
next_value min_value max_value start increment cache cycle round
|
|
1 1 9223372036854775806 1 1 1000 0 0
|
|
create or replace sequence t1 engine=innodb;
|
|
show create sequence t1;
|
|
Table Create Table
|
|
t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB
|
|
show create table t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
|
|
`min_value` bigint(21) NOT NULL COMMENT 'min value',
|
|
`max_value` bigint(21) NOT NULL COMMENT 'max value',
|
|
`start` bigint(21) NOT NULL COMMENT 'start value',
|
|
`increment` bigint(21) NOT NULL COMMENT 'increment value',
|
|
`cache` bigint(21) NOT NULL COMMENT 'cache size',
|
|
`cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
|
|
`round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
|
|
) ENGINE=InnoDB SEQUENCE=1
|
|
select * from t1;
|
|
next_value min_value max_value start increment cache cycle round
|
|
1 1 9223372036854775806 1 1 1000 0 0
|
|
create or replace sequence t1 engine=maria;
|
|
show create sequence t1;
|
|
Table Create Table
|
|
t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=Aria
|
|
show create table t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
|
|
`min_value` bigint(21) NOT NULL COMMENT 'min value',
|
|
`max_value` bigint(21) NOT NULL COMMENT 'max value',
|
|
`start` bigint(21) NOT NULL COMMENT 'start value',
|
|
`increment` bigint(21) NOT NULL COMMENT 'increment value',
|
|
`cache` bigint(21) NOT NULL COMMENT 'cache size',
|
|
`cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
|
|
`round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
|
|
) ENGINE=Aria SEQUENCE=1
|
|
select * from t1;
|
|
next_value min_value max_value start increment cache cycle round
|
|
1 1 9223372036854775806 1 1 1000 0 0
|
|
create or replace sequence t1 engine=archive;
|
|
ERROR HY000: Table storage engine 'ARCHIVE' does not support the create option 'SEQUENCE'
|
|
show create table t1;
|
|
ERROR 42S02: Table 'test.t1' doesn't exist
|
|
create or replace sequence t1 start with 10;
|
|
show create sequence t1;
|
|
Table Create Table
|
|
t1 CREATE SEQUENCE `t1` start with 10 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
|
|
select * from t1;
|
|
next_value min_value max_value start increment cache cycle round
|
|
10 1 9223372036854775806 10 1 1000 0 0
|
|
create or replace sequence t1 minvalue=11;
|
|
show create sequence t1;
|
|
Table Create Table
|
|
t1 CREATE SEQUENCE `t1` start with 11 minvalue 11 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
|
|
select * from t1;
|
|
next_value min_value max_value start increment cache cycle round
|
|
11 11 9223372036854775806 11 1 1000 0 0
|
|
create or replace sequence t1 maxvalue=13 increment by -1;
|
|
show create sequence t1;
|
|
Table Create Table
|
|
t1 CREATE SEQUENCE `t1` start with 13 minvalue -9223372036854775807 maxvalue 13 increment by -1 cache 1000 nocycle ENGINE=MyISAM
|
|
select * from t1;
|
|
next_value min_value max_value start increment cache cycle round
|
|
13 -9223372036854775807 13 13 -1 1000 0 0
|
|
create or replace sequence t1 increment by -1 cache 100;
|
|
show create sequence t1;
|
|
Table Create Table
|
|
t1 CREATE SEQUENCE `t1` start with -1 minvalue -9223372036854775807 maxvalue -1 increment by -1 cache 100 nocycle ENGINE=MyISAM
|
|
select * from t1;
|
|
next_value min_value max_value start increment cache cycle round
|
|
-1 -9223372036854775807 -1 -1 -1 100 0 0
|
|
create or replace sequence t1 cycle;
|
|
show create sequence t1;
|
|
Table Create Table
|
|
t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 cycle ENGINE=MyISAM
|
|
select * from t1;
|
|
next_value min_value max_value start increment cache cycle round
|
|
1 1 9223372036854775806 1 1 1000 1 0
|
|
create or replace sequence t1 nocycle;
|
|
show create sequence t1;
|
|
Table Create Table
|
|
t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
|
|
select * from t1;
|
|
next_value min_value max_value start increment cache cycle round
|
|
1 1 9223372036854775806 1 1 1000 0 0
|
|
show create sequence t1;
|
|
Table Create Table
|
|
t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
|
|
create or replace sequence t1 cycle minvalue= 14;
|
|
show create sequence t1;
|
|
Table Create Table
|
|
t1 CREATE SEQUENCE `t1` start with 14 minvalue 14 maxvalue 9223372036854775806 increment by 1 cache 1000 cycle ENGINE=MyISAM
|
|
select * from t1;
|
|
next_value min_value max_value start increment cache cycle round
|
|
14 14 9223372036854775806 14 1 1000 1 0
|
|
create or replace sequence t1 cycle increment by -1;
|
|
show create sequence t1;
|
|
Table Create Table
|
|
t1 CREATE SEQUENCE `t1` start with -1 minvalue -9223372036854775807 maxvalue -1 increment by -1 cache 1000 cycle ENGINE=MyISAM
|
|
drop sequence t1;
|
|
create sequence if not exists t1;
|
|
create sequence if not exists t1 start with 10;
|
|
Warnings:
|
|
Note 1050 Table 't1' already exists
|
|
select * from t1;
|
|
next_value min_value max_value start increment cache cycle round
|
|
1 1 9223372036854775806 1 1 1000 0 0
|
|
show create sequence t1;
|
|
Table Create Table
|
|
t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
|
|
create or replace sequence t1 start with 10 minvalue=10 maxvalue=11 nocache cycle;
|
|
show create sequence t1;
|
|
Table Create Table
|
|
t1 CREATE SEQUENCE `t1` start with 10 minvalue 10 maxvalue 11 increment by 1 nocache cycle ENGINE=MyISAM
|
|
select * from t1;
|
|
next_value min_value max_value start increment cache cycle round
|
|
10 10 11 10 1 0 1 0
|
|
create or replace sequence t1 start with 10 minvalue=-10 maxvalue=11 cache=10 cycle increment by 10;
|
|
show create sequence t1;
|
|
Table Create Table
|
|
t1 CREATE SEQUENCE `t1` start with 10 minvalue -10 maxvalue 11 increment by 10 cache 10 cycle ENGINE=MyISAM
|
|
select * from t1;
|
|
next_value min_value max_value start increment cache cycle round
|
|
10 -10 11 10 10 10 1 0
|
|
create or replace sequence t1 start with 10 NO MAXVALUE NO MINVALUE;
|
|
create or replace sequence t1 start with 10 maxvalue 10;
|
|
create or replace sequence t1 start with 10 minvalue 10;
|
|
create or replace sequence t1 start with 10 minvalue 10 maxvalue 11 cycle;
|
|
create or replace sequence t1 start with 10 maxvalue=9223372036854775806;
|
|
create or replace sequence t1 start with 10 minvalue=-9223372036854775807;
|
|
drop sequence if exists t1;
|
|
create sequence t1 increment by 0;
|
|
show create sequence t1;
|
|
Table Create Table
|
|
t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 0 cache 1000 nocycle ENGINE=MyISAM
|
|
select * from t1;
|
|
next_value min_value max_value start increment cache cycle round
|
|
1 1 9223372036854775806 1 0 1000 0 0
|
|
drop sequence t1;
|
|
create table t1 (a int);
|
|
show create sequence t1;
|
|
ERROR HY000: 'test.t1' is not SEQUENCE
|
|
drop sequence t1;
|
|
ERROR 42S02: 'test.t1' is not a SEQUENCE
|
|
drop sequence if exists t1;
|
|
Warnings:
|
|
Note 4066 Unknown SEQUENCE: 'test.t1'
|
|
create sequence t1 start with 10 maxvalue=9;
|
|
ERROR HY000: Sequence 'test.t1' values are conflicting
|
|
create sequence t1 minvalue= 100 maxvalue=10;
|
|
ERROR HY000: Sequence 'test.t1' values are conflicting
|
|
create sequence t1 start with 9 minvalue=10;
|
|
ERROR HY000: Sequence 'test.t1' values are conflicting
|
|
create or replace sequence t1 maxvalue=13, increment by -1;
|
|
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' increment by -1' at line 1
|
|
create or replace sequence t1 start with= 10 maxvalue=13;
|
|
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '= 10 maxvalue=13' at line 1
|
|
create or replace sequence t1 maxvalue=13, increment= -1;
|
|
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' increment= -1' at line 1
|
|
create or replace sequence t1 start with 10 min_value=1 NO MINVALUE;
|
|
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NO MINVALUE' at line 1
|
|
create or replace sequence t1 start with 10 min_value=1 NO MINVALUE;
|
|
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NO MINVALUE' at line 1
|
|
create sequence t1 start with 10 maxvalue=9223372036854775807;
|
|
ERROR HY000: Sequence 'test.t1' values are conflicting
|
|
create sequence t1 start with 10 minvalue=-9223372036854775808;
|
|
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '9223372036854775808' at line 1
|
|
create or replace sequence t1 start with 10 NO MINVALUE minvalue=1;
|
|
drop sequence t1;
|
|
create sequence t1;
|
|
show fields from t1;
|
|
Field Type Null Key Default Extra
|
|
next_value bigint(21) NO NULL
|
|
min_value bigint(21) NO NULL
|
|
max_value bigint(21) NO NULL
|
|
start bigint(21) NO NULL
|
|
increment bigint(21) NO NULL
|
|
cache bigint(21) NO NULL
|
|
cycle tinyint(1) unsigned NO NULL
|
|
round bigint(21) NO NULL
|
|
flush tables;
|
|
show fields from t1;
|
|
Field Type Null Key Default Extra
|
|
next_value bigint(21) NO NULL
|
|
min_value bigint(21) NO NULL
|
|
max_value bigint(21) NO NULL
|
|
start bigint(21) NO NULL
|
|
increment bigint(21) NO NULL
|
|
cache bigint(21) NO NULL
|
|
cycle tinyint(1) unsigned NO NULL
|
|
round bigint(21) NO NULL
|
|
create or replace sequence t1 engine=aria;
|
|
show fields from t1;
|
|
Field Type Null Key Default Extra
|
|
next_value bigint(21) NO NULL
|
|
min_value bigint(21) NO NULL
|
|
max_value bigint(21) NO NULL
|
|
start bigint(21) NO NULL
|
|
increment bigint(21) NO NULL
|
|
cache bigint(21) NO NULL
|
|
cycle tinyint(1) unsigned NO NULL
|
|
round bigint(21) NO NULL
|
|
show fields from t1;
|
|
Field Type Null Key Default Extra
|
|
next_value bigint(21) NO NULL
|
|
min_value bigint(21) NO NULL
|
|
max_value bigint(21) NO NULL
|
|
start bigint(21) NO NULL
|
|
increment bigint(21) NO NULL
|
|
cache bigint(21) NO NULL
|
|
cycle tinyint(1) unsigned NO NULL
|
|
round bigint(21) NO NULL
|
|
flush tables;
|
|
create or replace sequence t1 comment= "test 1";
|
|
show create sequence t1;
|
|
Table Create Table
|
|
t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM COMMENT='test 1'
|
|
show create table t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
|
|
`min_value` bigint(21) NOT NULL COMMENT 'min value',
|
|
`max_value` bigint(21) NOT NULL COMMENT 'max value',
|
|
`start` bigint(21) NOT NULL COMMENT 'start value',
|
|
`increment` bigint(21) NOT NULL COMMENT 'increment value',
|
|
`cache` bigint(21) NOT NULL COMMENT 'cache size',
|
|
`cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
|
|
`round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
|
|
) ENGINE=MyISAM SEQUENCE=1 COMMENT='test 1'
|
|
create or replace sequence t1 comment= "test 2" min_rows=1 max_rows=2;
|
|
show create sequence t1;
|
|
Table Create Table
|
|
t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM COMMENT='test 2'
|
|
show create table t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
|
|
`min_value` bigint(21) NOT NULL COMMENT 'min value',
|
|
`max_value` bigint(21) NOT NULL COMMENT 'max value',
|
|
`start` bigint(21) NOT NULL COMMENT 'start value',
|
|
`increment` bigint(21) NOT NULL COMMENT 'increment value',
|
|
`cache` bigint(21) NOT NULL COMMENT 'cache size',
|
|
`cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
|
|
`round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
|
|
) ENGINE=MyISAM MIN_ROWS=1 MAX_ROWS=2 SEQUENCE=1 COMMENT='test 2'
|
|
create or replace sequence t1 start=1 increment= 2;
|
|
create or replace sequence t1 start 1 increment 2;
|
|
drop sequence t1;
|
|
CREATE TABLE t1 (
|
|
`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=1;
|
|
show create sequence t1;
|
|
Table Create Table
|
|
t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
|
|
show create table t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`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 SEQUENCE=1
|
|
drop sequence t1;
|
|
CREATE OR REPLACE TABLE t1 (
|
|
`next_val` 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=1;
|
|
ERROR HY000: Sequence 'test.t1' table structure is invalid (next_val)
|
|
CREATE OR REPLACE TABLE t1 (
|
|
`next_value` int(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=1;
|
|
ERROR HY000: Sequence 'test.t1' table structure is invalid (next_value)
|
|
CREATE OR REPLACE TABLE t1 (
|
|
`next_val` 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` bigint(21) unsigned NOT NULL, /* error */
|
|
`round` bigint(21) NOT NULL
|
|
) sequence=1;
|
|
ERROR HY000: Sequence 'test.t1' table structure is invalid (next_val)
|
|
CREATE OR REPLACE TABLE t1 (
|
|
`next_value` bigint(21),
|
|
`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=1;
|
|
ERROR HY000: Sequence 'test.t1' table structure is invalid (next_value)
|
|
CREATE OR REPLACE TABLE t1 (
|
|
`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,
|
|
extra_field bigint(21)
|
|
) sequence=1;
|
|
ERROR HY000: Sequence 'test.t1' table structure is invalid (Wrong number of columns)
|
|
CREATE OR REPLACE TABLE t1 (
|
|
`min_value` bigint(21) NOT NULL,
|
|
`max_value` bigint(21) NOT NULL,
|
|
`next_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=1;
|
|
ERROR HY000: Sequence 'test.t1' table structure is invalid (min_value)
|
|
CREATE OR REPLACE TABLE t1 (
|
|
`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,
|
|
key key1 (next_value)
|
|
) sequence=1;
|
|
ERROR HY000: Sequence 'test.t1' table structure is invalid (Sequence tables cannot have any keys)
|
|
drop sequence if exists t1;
|
|
Warnings:
|
|
Note 4066 Unknown SEQUENCE: 'test.t1'
|
|
create sequence t1;
|
|
create sequence t2;
|
|
create table t3 (a int) engine=myisam;
|
|
select table_catalog, table_schema, table_name, table_type from information_schema.tables where table_catalog="test";
|
|
table_catalog table_schema table_name table_type
|
|
CREATE SEQUENCE s1;
|
|
drop sequence s1;
|
|
drop sequence if exists t1,t2,t3,t4;
|
|
Warnings:
|
|
Note 4066 Unknown SEQUENCE: 'test.t3'
|
|
Note 4066 Unknown SEQUENCE: 'test.t4'
|
|
drop table if exists t1,t2,t3;
|
|
Warnings:
|
|
Note 1051 Unknown table 'test.t1'
|
|
Note 1051 Unknown table 'test.t2'
|
|
CREATE TABLE t1 (a int);
|
|
CREATE TABLE t2 (a int);
|
|
CREATE SEQUENCE s1;
|
|
drop table t1,t2,s1;
|
|
CREATE TABLE t1 (a int);
|
|
CREATE TABLE t2 (a int);
|
|
CREATE SEQUENCE s1;
|
|
drop table if exists t1,t2,s1,s2;
|
|
Warnings:
|
|
Note 1051 Unknown table 'test.s2'
|
|
CREATE TABLE t1 (a int);
|
|
CREATE TABLE t2 (a int);
|
|
CREATE SEQUENCE s1;
|
|
drop sequence t1,t2,s1,s2;
|
|
ERROR 42S02: Unknown SEQUENCE: 'test.t1,test.t2,test.s2'
|
|
drop table if exists t1,t2;
|
|
CREATE TABLE t1 (a int);
|
|
CREATE TABLE t2 (a int);
|
|
CREATE SEQUENCE s1;
|
|
drop sequence if exists t1,t2,s1,s2;
|
|
Warnings:
|
|
Note 4066 Unknown SEQUENCE: 'test.t1'
|
|
Note 4066 Unknown SEQUENCE: 'test.t2'
|
|
Note 4066 Unknown SEQUENCE: 'test.s2'
|
|
drop table if exists t1,t2;
|
|
CREATE TEMPORARY SEQUENCE s1;
|
|
DROP SEQUENCE s1;
|
|
DROP TEMPORARY SEQUENCE s1;
|
|
ERROR 42S02: Unknown SEQUENCE: 'test.s1'
|
|
CREATE TEMPORARY SEQUENCE s1;
|
|
CREATE SEQUENCE s2;
|
|
CREATE TEMPORARY TABLE t1 (a int);
|
|
CREATE TABLE t2 (a int);
|
|
DROP TEMPORARY SEQUENCE t1,t2,s1,s2;
|
|
ERROR 42S02: Unknown SEQUENCE: 'test.t1,test.t2,test.s2'
|
|
DROP TEMPORARY SEQUENCE s1;
|
|
ERROR 42S02: Unknown SEQUENCE: 'test.s1'
|
|
DROP TEMPORARY TABLE t1;
|
|
DROP TABLE t1,t2,s1,s2;
|
|
ERROR 42S02: Unknown table 'test.t1,test.s1'
|
|
create view v1 as (select 1);
|
|
CREATE SEQUENCE s1;
|
|
DROP SEQUENCE s1,v1;
|
|
ERROR 42S02: 'test.v1' is a view
|
|
drop view v1;
|
|
CREATE TEMPORARY SEQUENCE t1;
|
|
select next value for t1;
|
|
next value for t1
|
|
1
|
|
drop temporary table t1;
|
|
select previous value for t1;
|
|
ERROR 42S02: Table 'test.t1' doesn't exist
|
|
CREATE SEQUENCE t1 start with 1 minvalue 1 maxvalue 10 increment by 1 cache 10;
|
|
select next value for t1;
|
|
next value for t1
|
|
1
|
|
select previous value for t1;
|
|
previous value for t1
|
|
1
|
|
CREATE TEMPORARY SEQUENCE t1 start with 100 minvalue 100 maxvalue 200 increment by 1 cache 10;
|
|
select previous value for t1;
|
|
previous value for t1
|
|
NULL
|
|
select next value for t1;
|
|
next value for t1
|
|
100
|
|
select previous value for t1;
|
|
previous value for t1
|
|
100
|
|
drop temporary sequence t1;
|
|
select previous value for t1;
|
|
previous value for t1
|
|
1
|
|
drop sequence t1;
|
|
CREATE TEMPORARY SEQUENCE t1 engine=innodb;
|
|
select next value for t1;
|
|
next value for t1
|
|
1
|
|
drop temporary table t1;
|
|
select previous value for t1;
|
|
ERROR 42S02: Table 'test.t1' doesn't exist
|
|
CREATE SEQUENCE t1 start with 1 minvalue 1 maxvalue 10 increment by 1 cache 10 engine=innodb;
|
|
select next value for t1;
|
|
next value for t1
|
|
1
|
|
select previous value for t1;
|
|
previous value for t1
|
|
1
|
|
CREATE TEMPORARY SEQUENCE t1 start with 100 minvalue 100 maxvalue 200 increment by 1 cache 10 engine=innodb;
|
|
select previous value for t1;
|
|
previous value for t1
|
|
NULL
|
|
select next value for t1;
|
|
next value for t1
|
|
100
|
|
select previous value for t1;
|
|
previous value for t1
|
|
100
|
|
drop temporary sequence t1;
|
|
select previous value for t1;
|
|
previous value for t1
|
|
1
|
|
drop sequence t1;
|
|
create table t1 (a int) engine=sql_sequence;
|
|
ERROR 42000: Unknown storage engine 'sql_sequence'
|