~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/alter_table.result

  • Committer: Brian Aker
  • Date: 2009-06-05 23:10:06 UTC
  • mto: This revision was merged to the branch mainline in revision 1055.
  • Revision ID: brian@gaz-20090605231006-01nyw7pfpj2z2v8p
Remove guts in parser for LOCK TABLE.

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
) ENGINE=MyISAM;
78
78
ALTER TABLE t1 ORDER BY t1.id, t1.status, t1.type_id, t1.user_id, t1.body;
79
79
DROP TABLE t1;
80
 
CREATE TABLE t1 (AnamneseId int NOT NULL auto_increment,B BLOB,PRIMARY KEY (AnamneseId)) engine=myisam;
81
 
insert into t1 values (null,"hello");
82
 
LOCK TABLES t1 WRITE;
83
 
ALTER TABLE t1 ADD Column new_col int not null;
84
 
UNLOCK TABLES;
85
 
OPTIMIZE TABLE t1;
86
 
Table   Op      Msg_type        Msg_text
87
 
test.t1 optimize        status  OK
88
 
DROP TABLE t1;
89
80
create table t1 (i int not null auto_increment primary key);
90
81
insert into t1 values (null),(null),(null),(null);
91
82
alter table t1 drop i,add i int not null auto_increment, drop primary key, add primary key (i);
311
302
CREATE TABLE t1 (
312
303
Host varchar(16) binary NOT NULL default '',
313
304
User varchar(16) binary NOT NULL default '',
314
 
PRIMARY KEY  (Host,User)
315
 
) ENGINE=MyISAM;
316
 
ALTER TABLE t1 DISABLE KEYS;
317
 
LOCK TABLES t1 WRITE;
318
 
INSERT INTO t1 VALUES ('localhost','root'),('localhost',''),('games','monty');
319
 
SHOW INDEX FROM t1;
320
 
Table   Non_unique      Key_name        Seq_in_index    Column_name     Collation       Cardinality     Sub_part        Packed  Null    Index_type      Comment Index_Comment
321
 
t1      0       PRIMARY 1       Host    A       NULL    NULL    NULL            BTREE           
322
 
t1      0       PRIMARY 2       User    A       0       NULL    NULL            BTREE           
323
 
ALTER TABLE t1 ENABLE KEYS;
324
 
UNLOCK TABLES;
325
 
CHECK TABLES t1;
326
 
Table   Op      Msg_type        Msg_text
327
 
test.t1 check   status  OK
328
 
DROP TABLE t1;
329
 
CREATE TABLE t1 (
330
 
Host varchar(16) binary NOT NULL default '',
331
 
User varchar(16) binary NOT NULL default '',
332
305
PRIMARY KEY  (Host,User),
333
306
KEY  (Host)
334
307
) ENGINE=MyISAM;
338
311
t1      0       PRIMARY 1       Host    A       NULL    NULL    NULL            BTREE           
339
312
t1      0       PRIMARY 2       User    A       0       NULL    NULL            BTREE           
340
313
t1      1       Host    1       Host    A       NULL    NULL    NULL            BTREE   disabled        
341
 
LOCK TABLES t1 WRITE;
342
314
INSERT INTO t1 VALUES ('localhost','root'),('localhost','');
343
315
SHOW INDEX FROM t1;
344
316
Table   Non_unique      Key_name        Seq_in_index    Column_name     Collation       Cardinality     Sub_part        Packed  Null    Index_type      Comment Index_Comment
345
317
t1      0       PRIMARY 1       Host    A       NULL    NULL    NULL            BTREE           
346
 
t1      0       PRIMARY 2       User    A       0       NULL    NULL            BTREE           
 
318
t1      0       PRIMARY 2       User    A       2       NULL    NULL            BTREE           
347
319
t1      1       Host    1       Host    A       NULL    NULL    NULL            BTREE   disabled        
348
320
ALTER TABLE t1 ENABLE KEYS;
349
321
SHOW INDEX FROM t1;
351
323
t1      0       PRIMARY 1       Host    A       NULL    NULL    NULL            BTREE           
352
324
t1      0       PRIMARY 2       User    A       2       NULL    NULL            BTREE           
353
325
t1      1       Host    1       Host    A       1       NULL    NULL            BTREE           
354
 
UNLOCK TABLES;
355
326
CHECK TABLES t1;
356
327
Table   Op      Msg_type        Msg_text
357
328
test.t1 check   status  OK
358
 
LOCK TABLES t1 WRITE;
359
329
ALTER TABLE t1 RENAME t2;
360
 
UNLOCK TABLES;
361
330
select * from t2;
362
331
Host    User
363
332
localhost       
364
333
localhost       root
365
334
DROP TABLE t2;
366
 
CREATE TABLE t1 (
367
 
Host varchar(16) binary NOT NULL default '',
368
 
User varchar(16) binary NOT NULL default '',
369
 
PRIMARY KEY  (Host,User),
370
 
KEY  (Host)
371
 
) ENGINE=MyISAM;
372
 
LOCK TABLES t1 WRITE;
373
 
ALTER TABLE t1 DISABLE KEYS;
374
 
SHOW INDEX FROM t1;
375
 
Table   Non_unique      Key_name        Seq_in_index    Column_name     Collation       Cardinality     Sub_part        Packed  Null    Index_type      Comment Index_Comment
376
 
t1      0       PRIMARY 1       Host    A       NULL    NULL    NULL            BTREE           
377
 
t1      0       PRIMARY 2       User    A       0       NULL    NULL            BTREE           
378
 
t1      1       Host    1       Host    A       NULL    NULL    NULL            BTREE   disabled        
379
 
DROP TABLE t1;
380
335
create table t1 (a int);
381
336
alter table t1 rename to ``;
382
337
ERROR 42000: Incorrect table name ''
846
801
abc     5
847
802
DROP TABLE t1;
848
803
End of 5.0 tests
849
 
drop table if exists t1, t2, t3;
850
 
create table t1 (i int);
851
 
create table t3 (j int);
852
 
insert into t1 values ();
853
 
insert into t3 values ();
854
 
lock table t1 write, t3 read;
855
 
alter table t1 modify i int default 1;
856
 
insert into t1 values ();
857
 
select * from t1;
858
 
i
859
 
NULL
860
 
1
861
 
alter table t1 change i c char(10) default "Two";
862
 
insert into t1 values ();
863
 
select * from t1;
864
 
c
865
 
NULL
866
 
1
867
 
Two
868
 
alter table t1 modify c char(10) default "Three", rename to t2;
869
 
select * from t1;
870
 
ERROR HY000: Table 't1' was not locked with LOCK TABLES
871
 
select * from t2;
872
 
ERROR HY000: Table 't2' was not locked with LOCK TABLES
873
 
select * from t3;
874
 
j
875
 
NULL
876
 
unlock tables;
877
 
insert into t2 values ();
878
 
select * from t2;
879
 
c
880
 
NULL
881
 
1
882
 
Two
883
 
Three
884
 
lock table t2 write, t3 read;
885
 
alter table t2 change c vc varchar(100) default "Four", rename to t1;
886
 
select * from t1;
887
 
ERROR HY000: Table 't1' was not locked with LOCK TABLES
888
 
select * from t2;
889
 
ERROR HY000: Table 't2' was not locked with LOCK TABLES
890
 
select * from t3;
891
 
j
892
 
NULL
893
 
unlock tables;
894
 
insert into t1 values ();
895
 
select * from t1;
896
 
vc
897
 
NULL
898
 
1
899
 
Two
900
 
Three
901
 
Four
902
 
drop tables t1, t3;
903
804
DROP TABLE IF EXISTS `t+1`, `t+2`;
904
805
CREATE TABLE `t+1` (c1 INT);
905
806
ALTER TABLE  `t+1` RENAME `t+2`;
998
899
f1      f2      f3
999
900
1       2       NULL
1000
901
DROP TABLE t1;
1001
 
create table t1 (c char(10) default "Two");
1002
 
lock table t1 write;
1003
 
insert into t1 values ();
1004
 
alter table t1 modify c char(10) default "Three";
1005
 
unlock tables;
1006
 
select * from t1;
1007
 
c
1008
 
Two
1009
 
check table t1;
1010
 
Table   Op      Msg_type        Msg_text
1011
 
test.t1 check   status  OK
1012
 
drop table t1;