github.com/matrixorigin/matrixone@v1.2.0/test/distributed/cases/sequence/create_sequence.result (about)

     1  create sequence seq_01 as int start 30;
     2  create sequence `123` start 30;
     3  select nextval('123');
     4  nextval(123)
     5  30
     6  create sequence SEQ increment 100 start 30;
     7  create sequence sEq increment 100 start 30;
     8  table seq already exists
     9  create sequence `中文` maxvalue 6899 cycle;
    10  select nextval('中文');
    11  nextval(中文)
    12  1
    13  select nextval('中文'),currval('中文');
    14  nextval(中文)    currval(中文)
    15  2    2
    16  create sequence `test@123456`;
    17  select nextval('test@123456');
    18  nextval(test@123456)
    19  1
    20  select nextval('test@123456'),currval('test@123456');
    21  nextval(test@123456)    currval(test@123456)
    22  2    2
    23  create sequence _acc;
    24  select nextval('_acc');
    25  nextval(_acc)
    26  1
    27  select nextval('_acc'),currval('_acc');
    28  nextval(_acc)    currval(_acc)
    29  2    2
    30  create sequence `ab.cd` start with 1;
    31  select nextval('ab.cd');
    32  nextval(ab.cd)
    33  1
    34  select nextval('ab.cd'),currval('ab.cd');
    35  nextval(ab.cd)    currval(ab.cd)
    36  2    2
    37  create sequence `abcddddddfsfafaffsefsfsefljofiseosfjosisssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss24444444444444444444444444222222222@fffffffffffffffffffffffffffffffffffffffffffffffffffff` start 30;
    38  select nextval('abcddddddfsfafaffsefsfsefljofiseosfjosisssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss24444444444444444444444444222222222@fffffffffffffffffffffffffffffffffffffffffffffffffffff') as s1;
    39  s1
    40  30
    41  create table if not exists seq_temp(col1 int);
    42  create sequence seq_temp start 10;
    43  table seq_temp already exists
    44  drop table seq_temp;
    45  create table if not exists table_temp(col1 int);
    46  create view seq_temp as select * from table_temp;
    47  create sequence seq_temp start 10;
    48  table seq_temp already exists
    49  drop view seq_temp;
    50  drop table table_temp;
    51  create external table seq_temp(num_col1 tinyint,num_col2 smallint,num_col3 int,num_col4 bigint,num_col5 tinyint unsigned,num_col6 smallint unsigned,num_col7 int unsigned,num_col8 bigint unsigned ,num_col9 float(5,3),num_col10 double,num_col11 decimal(38,19)) infile{"filepath"='$resources/external_table_file/ex_table_number.csv'} fields terminated by ',' enclosed by '\"' lines terminated by '\n';
    52  create sequence seq_temp start 10;
    53  table seq_temp already exists
    54  drop table seq_temp;
    55  create sequence seq_temp start 10;
    56  create sequence seq_temp start 10;
    57  table seq_temp already exists
    58  create sequence Seq_temp start 10;
    59  table seq_temp already exists
    60  create sequence sequence;
    61  create sequence table as bigint;
    62  SQL parser error: You have an error in your SQL syntax; check the manual that corresponds to your MatrixOne server version for the right syntax to use. syntax error at line 1 column 21 near " table as bigint;";
    63  create sequence seq_01 as tinyint unsigned MINVALUE 26  NO CYCLE;
    64  table seq_01 already exists
    65  create sequence if not exists seq_01 as tinyint unsigned MINVALUE 26  NO CYCLE;
    66  create sequence if not exists seq_02 as tinyint CYCLE;
    67  not supported: Unsupported type for sequence
    68  create sequence seq_03 increment 3;
    69  select nextval('seq_03');
    70  nextval(seq_03)
    71  1
    72  select nextval('seq_03'),currval('seq_03');
    73  nextval(seq_03)    currval(seq_03)
    74  4    4
    75  select nextval('seq_03');
    76  nextval(seq_03)
    77  7
    78  select nextval('seq_03');
    79  nextval(seq_03)
    80  10
    81  select * from seq_03;
    82  last_seq_num    min_value    max_value    start_value    increment_value    cycle    is_called
    83  10    1    9223372036854775807    1    3    false    true
    84  create sequence seq_04 increment by -10;
    85  select nextval('seq_04');
    86  nextval(seq_04)
    87  -1
    88  select nextval('seq_04'),currval('seq_04');
    89  nextval(seq_04)    currval(seq_04)
    90  -11    -11
    91  select nextval('seq_04');
    92  nextval(seq_04)
    93  -21
    94  select nextval('seq_04'),currval('seq_04');
    95  nextval(seq_04)    currval(seq_04)
    96  -31    -31
    97  create sequence seq_05 start 10000;
    98  select nextval('seq_05');
    99  nextval(seq_05)
   100  10000
   101  select nextval('seq_05'),currval('seq_05');
   102  nextval(seq_05)    currval(seq_05)
   103  10001    10001
   104  create table seq_table_01(col1 int);
   105  insert into seq_table_01 values(nextval('seq_05')),(nextval('seq_04')),(nextval('seq_05')),(nextval('seq_05'));
   106  select col1 from seq_table_01;
   107  col1
   108  10002
   109  -41
   110  10003
   111  10004
   112  create sequence seq_06 start with 10000;
   113  select nextval('seq_06');
   114  nextval(seq_06)
   115  10000
   116  select nextval('seq_06'),currval('seq_06');
   117  nextval(seq_06)    currval(seq_06)
   118  10001    10001
   119  select nextval('seq_06'),currval('seq_06');
   120  nextval(seq_06)    currval(seq_06)
   121  10002    10002
   122  select nextval('seq_06');
   123  nextval(seq_06)
   124  10003
   125  select nextval('seq_06');
   126  nextval(seq_06)
   127  10004
   128  select * from seq_06;
   129  last_seq_num    min_value    max_value    start_value    increment_value    cycle    is_called
   130  10004    1    9223372036854775807    10000    1    false    true
   131  truncate table seq_table_01;
   132  insert into seq_table_01 values(nextval('seq_06')),(nextval('seq_06'));
   133  insert into seq_table_01 values(nextval('seq_06'));
   134  select col1 from seq_table_01;
   135  col1
   136  10005
   137  10006
   138  10007
   139  create sequence seq_07 minvalue 999 maxvalue 1999;
   140  select nextval('seq_07');
   141  nextval(seq_07)
   142  999
   143  select nextval('seq_07'),currval('seq_07');
   144  nextval(seq_07)    currval(seq_07)
   145  1000    1000
   146  select nextval('seq_07'),currval('seq_07');
   147  nextval(seq_07)    currval(seq_07)
   148  1001    1001
   149  select nextval('seq_07');
   150  nextval(seq_07)
   151  1002
   152  select setval('seq_07',1050,false);
   153  setval(seq_07, 1050, false)
   154  1050
   155  select lastval();
   156  lastval()
   157  1002
   158  truncate table seq_table_01;
   159  insert into seq_table_01 values(nextval('seq_07'));
   160  insert into seq_table_01 select nextval('seq_07');
   161  select * from seq_table_01;
   162  col1
   163  1051
   164  1052
   165  create sequence seq_08;
   166  select nextval('seq_08');
   167  nextval(seq_08)
   168  1
   169  select nextval('seq_08'),currval('seq_08');
   170  nextval(seq_08)    currval(seq_08)
   171  2    2
   172  select nextval('seq_08'),currval('seq_08');
   173  nextval(seq_08)    currval(seq_08)
   174  3    3
   175  create sequence seq_09 minvalue 10 maxvalue 12 no cycle;
   176  select nextval('seq_09');
   177  nextval(seq_09)
   178  10
   179  select nextval('seq_09');
   180  nextval(seq_09)
   181  11
   182  select nextval('seq_09');
   183  nextval(seq_09)
   184  12
   185  select nextval('seq_09');
   186  internal error: Reached maximum value of sequence seq_09
   187  drop sequence seq_09;
   188  create sequence seq_09 increment 2 minvalue 10 maxvalue 12 cycle;
   189  select nextval('seq_09');
   190  nextval(seq_09)
   191  10
   192  select nextval('seq_09');
   193  nextval(seq_09)
   194  12
   195  select nextval('seq_09');
   196  nextval(seq_09)
   197  10
   198  select nextval('seq_09');
   199  nextval(seq_09)
   200  12
   201  select * from seq_09;
   202  last_seq_num    min_value    max_value    start_value    increment_value    cycle    is_called
   203  12    10    12    10    2    true    true
   204  create sequence seq_10 minvalue 1000;
   205  select nextval('seq_10');
   206  nextval(seq_10)
   207  1000
   208  select nextval('seq_10'),currval('seq_10');
   209  nextval(seq_10)    currval(seq_10)
   210  1001    1001
   211  select nextval('seq_10');
   212  nextval(seq_10)
   213  1002
   214  select nextval('seq_10');
   215  nextval(seq_10)
   216  1003
   217  select nextval('seq_08'),currval('seq_08');
   218  nextval(seq_08)    currval(seq_08)
   219  4    4
   220  create sequence seq_11 as smallint start 126;
   221  select nextval('seq_11');
   222  nextval(seq_11)
   223  126
   224  select nextval('seq_11'),currval('seq_11');
   225  nextval(seq_11)    currval(seq_11)
   226  127    127
   227  select nextval('seq_11');
   228  nextval(seq_11)
   229  128
   230  select nextval('seq_11');
   231  nextval(seq_11)
   232  129
   233  create sequence if not exists seq_12 as bigint increment by 10000 minvalue 500  start with 500 cycle;
   234  select nextval('seq_12');
   235  nextval(seq_12)
   236  500
   237  select nextval('seq_12'),currval('seq_12');
   238  nextval(seq_12)    currval(seq_12)
   239  10500    10500
   240  select nextval('seq_12'),currval('seq_12');
   241  nextval(seq_12)    currval(seq_12)
   242  20500    20500
   243  select nextval('seq_12');
   244  nextval(seq_12)
   245  30500
   246  select * from seq_12;
   247  last_seq_num    min_value    max_value    start_value    increment_value    cycle    is_called
   248  30500    500    9223372036854775807    500    10000    true    true
   249  truncate table seq_table_01;
   250  insert into seq_table_01 select nextval('seq_12');
   251  insert into seq_table_01 values(nextval('seq_12'));
   252  select * from seq_table_01;
   253  col1
   254  40500
   255  50500
   256  create sequence seq_13 as int increment -10000  no cycle;
   257  select nextval('seq_13');
   258  nextval(seq_13)
   259  -1
   260  select nextval('seq_13'),currval('seq_13');
   261  nextval(seq_13)    currval(seq_13)
   262  -10001    -10001
   263  truncate table seq_table_01;
   264  insert into seq_table_01 select nextval('seq_13');
   265  insert into seq_table_01 values(nextval('seq_13'));
   266  select * from seq_table_01;
   267  col1
   268  -20001
   269  -30001
   270  create sequence seq_14  increment 50 start with 126 no cycle;
   271  select nextval('seq_14');
   272  nextval(seq_14)
   273  126
   274  select nextval('seq_14'),currval('seq_14');
   275  nextval(seq_14)    currval(seq_14)
   276  176    176
   277  truncate table seq_table_01;
   278  insert into seq_table_01 select nextval('seq_14');
   279  insert into seq_table_01 values(nextval('seq_14'));
   280  insert into seq_table_01 values(nextval('seq_14'));
   281  insert into seq_table_01 values(nextval('seq_14'));
   282  insert into seq_table_01 values(nextval('seq_14'));
   283  select * from seq_table_01;
   284  col1
   285  226
   286  276
   287  326
   288  376
   289  426
   290  create sequence seq_an_01 as smallint start -1000;
   291  invalid input: STARTVALUE (-1000) for sequence must between MINVALUE (1) and MAXVALUE (32767)
   292  create sequence if not exists seq_an_01 as bigint increment by 10000 minvalue 500  start with 100;
   293  invalid input: STARTVALUE (100) for sequence must between MINVALUE (500) and MAXVALUE (9223372036854775807)
   294  create sequence seq_an_01 as smallint maxvalue 9999999 start with -10;
   295  invalid input: MAXVALUE (-27009) of sequence must be bigger than MINVALUE (1) of it
   296  create sequence seq_an_01 start with 0;
   297  invalid input: STARTVALUE (0) for sequence must between MINVALUE (1) and MAXVALUE (9223372036854775807)
   298  create sequence seq_an_02 as tinyint unsigned;
   299  not supported: Unsupported type for sequence
   300  create sequence seq_an_02 as tinyint;
   301  not supported: Unsupported type for sequence
   302  create sequence seq_an_03  increment -50 start with 126 no cycle;
   303  invalid input: STARTVALUE (126) for sequence must between MINVALUE (-9223372036854775808) and MAXVALUE (-1)
   304  show sequences;
   305  Names    Data Type
   306  seq_01    INT
   307  123    BIGINT
   308  seq    BIGINT
   309  中文    BIGINT
   310  test@123456    BIGINT
   311  _acc    BIGINT
   312  ab.cd    BIGINT
   313  abcddddddfsfafaffsefsfsefljofiseosfjosisssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss24444444444444444444444444222222222@fffffffffffffffffffffffffffffffffffffffffffffffffffff    BIGINT
   314  seq_temp    BIGINT
   315  sequence    BIGINT
   316  seq_03    BIGINT
   317  seq_04    BIGINT
   318  seq_05    BIGINT
   319  seq_06    BIGINT
   320  seq_07    BIGINT
   321  seq_08    BIGINT
   322  seq_09    BIGINT
   323  seq_10    BIGINT
   324  seq_11    SMALLINT
   325  seq_12    BIGINT
   326  seq_13    INT
   327  seq_14    BIGINT
   328  show sequences where names in('seq_05','seq_06');
   329  names    data type
   330  seq_05    BIGINT
   331  seq_06    BIGINT
   332  drop sequence seq_15;
   333  no such sequence create_sequence.seq_15
   334  drop sequence if exists seq_15;
   335  drop sequence seq_15;
   336  no such sequence create_sequence.seq_15
   337  drop sequence seq_non;
   338  no such sequence create_sequence.seq_non
   339  create sequence seq_15;
   340  create sequence seq_16 increment 10 start with 20 no cycle;
   341  truncate table seq_table_01;
   342  prepare stmt1 from 'insert into seq_table_01 values(?)';
   343  set @a_var = nextval('seq_15');
   344  execute stmt1 using @a_var;
   345  select * from seq_table_01;
   346  col1
   347  1
   348  execute stmt1 using @a_var;
   349  select * from seq_table_01;
   350  col1
   351  1
   352  1
   353  execute stmt1 using @a_var;
   354  select * from seq_table_01;
   355  col1
   356  1
   357  1
   358  1
   359  drop sequence seq_16;
   360  drop sequence seq_15;
   361  create sequence seq_17 increment 10 start with 20 no cycle;
   362  select lastval();
   363  lastval()
   364  1
   365  select nextval('seq_17');
   366  nextval(seq_17)
   367  20
   368  select lastval();
   369  lastval()
   370  20
   371  select setval('seq_17',5);
   372  setval(seq_17, 5)
   373  5
   374  select nextval('seq_17'),currval('seq_17');
   375  nextval(seq_17)    currval(seq_17)
   376  15    15
   377  select setval('seq_17',8,false);
   378  setval(seq_17, 8, false)
   379  8
   380  select nextval('seq_17'),currval('seq_17');
   381  nextval(seq_17)    currval(seq_17)
   382  18    18
   383  select nextval('seq_17'),currval('seq_17');
   384  nextval(seq_17)    currval(seq_17)
   385  28    28
   386  select lastval();
   387  lastval()
   388  28
   389  begin;
   390  create sequence seq_18 minvalue 1000;
   391  select nextval('seq_18');
   392  SQL parser error: table "seq_18" does not exist
   393  select nextval('seq_18');
   394  ExpectedEOB
   395  create sequence seq_18;
   396  ExpectedEOB
   397  select nextval('seq_18');
   398  SQL parser error: table "seq_18" does not exist
   399  commit;
   400  select nextval('seq_18'),currval('seq_18');
   401  SQL parser error: table "seq_18" does not exist
   402  drop sequence seq_18;
   403  no such sequence create_sequence.seq_18
   404  begin;
   405  create sequence seq_19 minvalue 1000;
   406  select nextval('seq_19');
   407  SQL parser error: table "seq_19" does not exist
   408  select nextval('seq_19');
   409  ExpectedEOB
   410  create sequence seq_19;
   411  ExpectedEOB
   412  rollback;
   413  select nextval('seq_19');
   414  SQL parser error: table "seq_19" does not exist
   415  drop sequence seq_19;
   416  no such sequence create_sequence.seq_19
   417  start transaction ;
   418  create sequence seq_20 increment by -10;
   419  select nextval('seq_20');
   420  SQL parser error: table "seq_20" does not exist
   421  rollback;
   422  select nextval('seq_20');
   423  SQL parser error: table "seq_20" does not exist
   424  drop sequence seq_20;
   425  no such sequence create_sequence.seq_20