1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-15 22:22:17 +03:00
Files
mariadb-columnstore-engine/mysql/queries/working_dml/misc/autoincrement.negative.sql
2016-01-06 14:08:59 -06:00

47 lines
4.0 KiB
SQL

drop table if exists foo;
Create table foo ( ai bigint, col1 int, col2 varchar(255)) engine=infinidb comment='autoincrement=ai';
insert into foo values(0, 1,'a');
insert into foo values(null,2, 'b');
insert into foo values(null, 3, 'c'), (0, 4, 'd'), (6,5, 'e'),(0,6, 'f');
select * from foo order by 1,2,3;
select callastinsertid('foo');
update foo set ai = null;
select * from foo order by 1,2,3;
select callastinsertid('foo');
update foo set ai = 0;
select * from foo order by 1,2,3;
select callastinsertid('foo');
update foo set ai = 10;
select * from foo order by 1,2,3;
select callastinsertid('foo');
drop table if exists foo;
Create table foo ( ai tinyint, col1 int, col2 varchar(255)) engine=infinidb comment='autoincrement=ai, 300';
Create table foo ( ai tinyint, col1 int, col2 varchar(255)) engine=infinidb comment='autoincrement= col2';
Create table foo ( ai bigint, col1 int, col2 varchar(255)) engine=infinidb comment='autoincrement=ai, autoincrement=col1';
Create table foo ( ai tinyint comment 'autoincrement, 200', col1 int, col2 varchar(255)) engine=infinidb;
Create table foo ( ai tinyint, col1 int, col2 varchar(255) comment 'autoincrement') engine=infinidb;
Create table foo ( ai tinyint comment 'autoincrement', col1 int, col2 varchar(255) comment 'autoincrement') engine=infinidb;
Create table foo ( ai tinyint comment 'autoincrement, 127', col1 int, col2 varchar(255)) engine=infinidb;
Insert into foo values(null, 1,'first');
Insert into foo values(0, 1,'first');
Insert into foo values(130, 1,'first');
update foo set ai = 200;
select * from foo order by 1,2,3;
select callastinsertid('foo');
drop table if exists foo;
create table foo (col1 int) engine=infinidb;
insert into foo values ( 1 ), ( 2 ), ( 3 ), ( 4 ), ( 5 ), ( 6 ), ( 7 ), ( 8 ), ( 9 ), ( 10 ), ( 11 ), ( 12 ), ( 13 ), ( 14 ), ( 15 ), ( 16 ), ( 17 ), ( 18 ), ( 19 ), ( 20 ), ( 21 ), ( 22 ), ( 23 ), ( 24 ), ( 25 ), ( 26 ), ( 27 ), ( 28 ), ( 29 ), ( 30 ), ( 31 ), ( 32 ), ( 33 ), ( 34 ), ( 35 ), ( 36 ), ( 37 ), ( 38 ), ( 39 ), ( 40 ), ( 41 ), ( 42 ), ( 43 ), ( 44 ), ( 45 ), ( 46 ), ( 47 ), ( 48 ), ( 49 ), ( 50 ), ( 51 ), ( 52 ), ( 53 ), ( 54 ), ( 55 ), ( 56 ), ( 57 ), ( 58 ), ( 59 ), ( 60 ), ( 61 ), ( 62 ), ( 63 ), ( 64 ), ( 65 ), ( 66 ), ( 67 ), ( 68 ), ( 69 ), ( 70 ), ( 71 ), ( 72 ), ( 73 ), ( 74 ), ( 75 ), ( 76 ), ( 77 ), ( 78 ), ( 79 ), ( 80 ), ( 81 ), ( 82 ), ( 83 ), ( 84 ), ( 85 ), ( 86 ), ( 87 ), ( 88 ), ( 89 ), ( 90 ), ( 91 ), ( 92 ), ( 93 ), ( 94 ), ( 95 ), ( 96 ), ( 97 ), ( 98 ), ( 99 ), ( 100 ), ( 101 ), ( 102 ), ( 103 ), ( 104 ), ( 105 ), ( 106 ), ( 107 ), ( 108 ), ( 109 ), ( 110 ), ( 111 ), ( 112 ), ( 113 ), ( 114 ), ( 115 ), ( 116 ), ( 117 ), ( 118 ), ( 119 ), ( 120 ), ( 121 ), ( 122 ), ( 123 ), ( 124 ), ( 125 ), ( 126 ), ( 127 ), ( 128 ), ( 129 ), ( 130 ), ( 131 ), ( 132 ), ( 133 ), ( 134 ), ( 135 ), ( 136 ), ( 137 ), ( 138 ), ( 139 ), ( 140 ), ( 141 ), ( 142 ), ( 143 ), ( 144 ), ( 145 ), ( 146 ), ( 147 ), ( 148 ), ( 149 ), ( 150 ), ( 151 ), ( 152 ), ( 153 ), ( 154 ), ( 155 ), ( 156 ), ( 157 ), ( 158 ), ( 159 ), ( 160 ), ( 161 ), ( 162 ), ( 163 ), ( 164 ), ( 165 ), ( 166 ), ( 167 ), ( 168 ), ( 169 ), ( 170 ), ( 171 ), ( 172 ), ( 173 ), ( 174 ), ( 175 ), ( 176 ), ( 177 ), ( 178 ), ( 179 ), ( 180 ), ( 181 ), ( 182 ), ( 183 ), ( 184 ), ( 185 ), ( 186 ), ( 187 ), ( 188 ), ( 189 ), ( 190 ), ( 191 ), ( 192 ), ( 193 ), ( 194 ), ( 195 ), ( 196 ), ( 197 ), ( 198 ), ( 199 ), ( 200 );
Alter table foo add column newcol bigint comment 'autoincrement';
select min(newcol), max(newcol) from foo;
select callastinsertid('foo');
Alter table foo change column newcol newcol bigint;
insert into foo values(201, 0);
select min(newcol), max(newcol), min(col1), max(col1) from foo;
Alter table foo change column newcol newcol bigint comment 'autoincrement';
insert into foo values(202, 0);
select min(newcol), max(newcol), min(col1), max(col1) from foo;
select callastinsertid('foo');
drop table if exists foo;
drop table if exists t2;
create table t2 (No2 int, Field int, Count int) engine=infinidb comment='autoincrement=No';