~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to plugin/haildb/tests/t/truncate.test

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-06-19 10:46:49 UTC
  • mfrom: (1.1.6)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20120619104649-e2l0ggd4oz3um0f4
Tags: upstream-7.1.36-stable
ImportĀ upstreamĀ versionĀ 7.1.36-stable

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#
2
 
# Test of truncate
3
 
#
4
 
--disable_warnings
5
 
drop table if exists t1;
6
 
--enable_warnings
7
 
 
8
 
create table t1 (a integer, b integer,c1 CHAR(10), primary key (a,b));
9
 
insert into t1 (a,b) values (1,3),(2,3);
10
 
truncate table t1;
11
 
select count(*) from t1;
12
 
insert into t1 values(1,2,"test");
13
 
select count(*) from t1;
14
 
delete from t1;
15
 
select * from t1;
16
 
drop table t1;
17
 
# The following should fail
18
 
--error ER_TABLE_UNKNOWN
19
 
select count(*) from t1;
20
 
create table t1 (n int primary key);
21
 
insert into t1 values (1),(2),(3);
22
 
truncate table t1;
23
 
select * from t1;
24
 
drop table t1;
25
 
--error ER_TABLE_UNKNOWN
26
 
truncate non_existing_table;
27
 
 
28
 
#
29
 
# test autoincrement with TRUNCATE; verifying difference with DELETE
30
 
#
31
 
 
32
 
create table t1 (a integer auto_increment primary key);
33
 
insert into t1 (a) values (NULL),(NULL);
34
 
truncate table t1;
35
 
insert into t1 (a) values (NULL),(NULL);
36
 
SELECT * from t1;
37
 
delete from t1;
38
 
insert into t1 (a) values (NULL),(NULL);
39
 
SELECT * from t1;
40
 
drop table t1;
41
 
 
42
 
# Verifying that temp tables are handled the same way
43
 
 
44
 
create table t1 (a integer auto_increment primary key);
45
 
insert into t1 (a) values (NULL),(NULL);
46
 
truncate table t1;
47
 
insert into t1 (a) values (NULL),(NULL);
48
 
SELECT * from t1;
49
 
delete from t1;
50
 
insert into t1 (a) values (NULL),(NULL);
51
 
SELECT * from t1;
52
 
drop table t1;
53
 
 
54
 
# End of 4.1 tests