~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/insert_select.test

  • Committer: Brian Aker
  • Date: 2010-05-27 01:25:56 UTC
  • mfrom: (1567.1.4 new-staging)
  • Revision ID: brian@gaz-20100527012556-5zgkirkl7swbigd6
Merge of Brian, Paul. PBXT compile issue, and test framework cleanup. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
drop table if exists t1,t2,t3;
7
7
--enable_warnings
8
8
 
9
 
create table t1 (bandID MEDIUMINT UNSIGNED NOT NULL PRIMARY KEY, payoutID SMALLINT UNSIGNED NOT NULL);
 
9
create table t1 (bandID INT NOT NULL PRIMARY KEY, payoutID int NOT NULL);
10
10
insert into t1 (bandID,payoutID) VALUES (1,6),(2,6),(3,4),(4,9),(5,10),(6,1),(7,12),(8,12);
11
 
create table t2 (payoutID SMALLINT UNSIGNED NOT NULL PRIMARY KEY);
 
11
create table t2 (payoutID int NOT NULL PRIMARY KEY);
12
12
insert into t2 (payoutID) SELECT DISTINCT payoutID FROM t1;
13
13
--error ER_DUP_ENTRY
14
14
insert into t2 (payoutID) SELECT payoutID+10 FROM t1;
21
21
# test case by Fournier Jocelyn <joc@presence-pc.com>
22
22
#
23
23
 
24
 
CREATE TABLE `t1` (
25
 
  `numeropost` bigint(20) unsigned NOT NULL default '0',
26
 
  `icone` tinyint(4) unsigned NOT NULL default '0',
27
 
  `numreponse` bigint(20) unsigned NOT NULL auto_increment,
 
24
CREATE TEMPORARY TABLE `t1` (
 
25
  `numeropost` bigint NOT NULL default '0',
 
26
  `icone` int NOT NULL default '0',
 
27
  `numreponse` bigint NOT NULL auto_increment,
28
28
  `contenu` text NOT NULL,
29
29
  `pseudo` varchar(50) NOT NULL default '',
30
 
  `date` datetime NOT NULL default '0000-00-00 00:00:00',
31
 
  `ip` bigint(11) NOT NULL default '0',
32
 
  `signature` tinyint(1) unsigned NOT NULL default '0',
 
30
  `date` datetime,
 
31
  `ip` bigint NOT NULL default '0',
 
32
  `signature` int NOT NULL default '0',
33
33
  PRIMARY KEY  (`numeropost`,`numreponse`)
34
34
  ,KEY `ip` (`ip`),
35
35
  KEY `date` (`date`),
37
37
  KEY `numreponse` (`numreponse`)
38
38
) ENGINE=MyISAM;
39
39
 
40
 
CREATE TABLE `t2` (
41
 
  `numeropost` bigint(20) unsigned NOT NULL default '0',
42
 
  `icone` tinyint(4) unsigned NOT NULL default '0',
43
 
  `numreponse` bigint(20) unsigned NOT NULL auto_increment,
 
40
CREATE TEMPORARY TABLE `t2` (
 
41
  `numeropost` bigint NOT NULL default '0',
 
42
  `icone` int NOT NULL default '0',
 
43
  `numreponse` bigint NOT NULL auto_increment,
44
44
  `contenu` text NOT NULL,
45
45
  `pseudo` varchar(50) NOT NULL default '',
46
 
  `date` datetime NOT NULL default '0000-00-00 00:00:00',
47
 
  `ip` bigint(11) NOT NULL default '0',
48
 
  `signature` tinyint(1) unsigned NOT NULL default '0',
 
46
  `date` datetime,
 
47
  `ip` bigint NOT NULL default '0',
 
48
  `signature` int NOT NULL default '0',
49
49
  PRIMARY KEY  (`numeropost`,`numreponse`),
50
50
  KEY `ip` (`ip`),
51
51
  KEY `date` (`date`),
113
113
# Test that caused uninitialized memory access in auto_increment_key update
114
114
#
115
115
 
116
 
CREATE TABLE t1 ( USID INTEGER UNSIGNED, ServerID TINYINT UNSIGNED, State ENUM ('unknown', 'Access-Granted', 'Session-Active', 'Session-Closed' ) NOT NULL DEFAULT 'unknown', SessionID CHAR(32), User CHAR(32) NOT NULL DEFAULT '<UNKNOWN>', NASAddr INTEGER UNSIGNED, NASPort INTEGER UNSIGNED, NASPortType INTEGER UNSIGNED, ConnectSpeed INTEGER UNSIGNED, CarrierType CHAR(32), CallingStationID CHAR(32), CalledStationID CHAR(32), AssignedAddr INTEGER UNSIGNED, SessionTime INTEGER UNSIGNED, PacketsIn INTEGER UNSIGNED, OctetsIn INTEGER UNSIGNED, PacketsOut INTEGER UNSIGNED, OctetsOut INTEGER UNSIGNED, TerminateCause INTEGER UNSIGNED, UnauthTime TINYINT UNSIGNED, AccessRequestTime DATETIME, AcctStartTime DATETIME, AcctLastTime DATETIME, LastModification TIMESTAMP NOT NULL);
117
 
CREATE TABLE t2 ( USID INTEGER UNSIGNED AUTO_INCREMENT, ServerID TINYINT UNSIGNED, State ENUM ('unknown', 'Access-Granted', 'Session-Active', 'Session-Closed' ) NOT NULL DEFAULT 'unknown', SessionID CHAR(32), User TEXT NOT NULL, NASAddr INTEGER UNSIGNED, NASPort INTEGER UNSIGNED, NASPortType INTEGER UNSIGNED, ConnectSpeed INTEGER UNSIGNED, CarrierType CHAR(32), CallingStationID CHAR(32), CalledStationID CHAR(32), AssignedAddr INTEGER UNSIGNED, SessionTime INTEGER UNSIGNED, PacketsIn INTEGER UNSIGNED, OctetsIn INTEGER UNSIGNED, PacketsOut INTEGER UNSIGNED, OctetsOut INTEGER UNSIGNED, TerminateCause INTEGER UNSIGNED, UnauthTime TINYINT UNSIGNED, AccessRequestTime DATETIME, AcctStartTime DATETIME, AcctLastTime DATETIME, LastModification TIMESTAMP NOT NULL, INDEX(USID,ServerID,NASAddr,SessionID), INDEX(AssignedAddr));
 
116
CREATE TABLE t1 ( USID INTEGER, ServerID int, State ENUM ('unknown', 'Access-Granted', 'Session-Active', 'Session-Closed' ) NOT NULL DEFAULT 'unknown', SessionID CHAR(32), User CHAR(32) NOT NULL DEFAULT '<UNKNOWN>', NASAddr INTEGER, NASPort INTEGER, NASPortType INTEGER, ConnectSpeed INTEGER, CarrierType CHAR(32), CallingStationID CHAR(32), CalledStationID CHAR(32), AssignedAddr INTEGER, SessionTime INTEGER, PacketsIn INTEGER, OctetsIn INTEGER, PacketsOut INTEGER, OctetsOut INTEGER, TerminateCause INTEGER, UnauthTime int, AccessRequestTime DATETIME, AcctStartTime DATETIME, AcctLastTime DATETIME, LastModification TIMESTAMP NOT NULL);
 
117
CREATE TABLE t2 ( USID INTEGER AUTO_INCREMENT, ServerID int, State ENUM ('unknown', 'Access-Granted', 'Session-Active', 'Session-Closed' ) NOT NULL DEFAULT 'unknown', SessionID CHAR(32), User TEXT NOT NULL, NASAddr INTEGER, NASPort INTEGER, NASPortType INTEGER, ConnectSpeed INTEGER, CarrierType CHAR(32), CallingStationID CHAR(32), CalledStationID CHAR(32), AssignedAddr INTEGER, SessionTime INTEGER, PacketsIn INTEGER, OctetsIn INTEGER, PacketsOut INTEGER, OctetsOut INTEGER, TerminateCause INTEGER, UnauthTime int, AccessRequestTime DATETIME, AcctStartTime DATETIME, AcctLastTime DATETIME, LastModification TIMESTAMP NOT NULL, INDEX(USID,ServerID,NASAddr,SessionID), INDEX(AssignedAddr));
118
118
INSERT INTO t1 VALUES (39,42,'Access-Granted','46','491721000045',2130706433,17690,NULL,NULL,'Localnet','491721000045','49172200000',754974766,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2003-07-18 00:11:21',NULL,NULL,20030718001121);
119
119
INSERT INTO t2 SELECT USID, ServerID, State, SessionID, User, NASAddr, NASPort, NASPortType, ConnectSpeed, CarrierType, CallingStationID, CalledStationID, AssignedAddr, SessionTime, PacketsIn, OctetsIn, PacketsOut, OctetsOut, TerminateCause, UnauthTime, AccessRequestTime, AcctStartTime, AcctLastTime, LastModification from t1 LIMIT 1;
120
120
drop table t1,t2;
125
125
 
126
126
CREATE TABLE t1(
127
127
 Month date NOT NULL,
128
 
 Type tinyint(3) unsigned NOT NULL auto_increment,
129
 
 Field int(10) unsigned NOT NULL,
130
 
 Count int(10) unsigned NOT NULL,
 
128
 Type int NOT NULL auto_increment,
 
129
 Field int NOT NULL,
 
130
 Count int NOT NULL,
 
131
 PRIMARY KEY (Type),
131
132
 UNIQUE KEY Month (Month,Type,Field)
132
133
);
133
134
          
134
 
insert into t1 Values
135
 
(20030901, 1, 1, 100),
136
 
(20030901, 1, 2, 100),
137
 
(20030901, 2, 1, 100),
138
 
(20030901, 2, 2, 100),
139
 
(20030901, 3, 1, 100);
 
135
insert into t1 Values (20030901, 1, 1, 100);
 
136
insert into t1 Values (20030901, 2, 2, 100);
 
137
insert into t1 Values (20030901, 3, 3, 100);
 
138
insert into t1 Values (20030901, 4, 4, 100);
 
139
insert into t1 Values (20030901, 5, 5, 100);
140
140
 
141
141
select * from t1;
142
142
          
154
154
# BUG#6034 - Error code 124:  Wrong medium type
155
155
#
156
156
CREATE TABLE t1 (
157
 
  ID           int(11) NOT NULL auto_increment,
158
 
  NO           int(11) NOT NULL default '0',
159
 
  SEQ          int(11) NOT NULL default '0',
 
157
  ID           int NOT NULL auto_increment,
 
158
  NO           int NOT NULL default '0',
 
159
  SEQ          int NOT NULL default '0',
160
160
  PRIMARY KEY  (ID),
161
161
  KEY t1$NO    (SEQ,NO)
162
 
) ENGINE=MyISAM;
 
162
);
163
163
INSERT INTO t1 (SEQ, NO) SELECT "1" AS SEQ, IF(MAX(NO) IS NULL, 0, MAX(NO)) + 1 AS NO FROM t1 WHERE (SEQ = 1);
164
164
select SQL_BUFFER_RESULT * from t1 WHERE (SEQ = 1);
165
165
drop table t1;
235
235
 
236
236
flush status;
237
237
INSERT INTO t1 SELECT a + 2 FROM t1 LIMIT 1;
 
238
--replace_column 2 #
238
239
show status like 'Handler_read%';
239
240
 
240
241
DROP TABLE t1;
244
245
#
245
246
 
246
247
CREATE TABLE t1 (
247
 
    f1 int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
 
248
    f1 int NOT NULL auto_increment PRIMARY KEY,
248
249
    f2 varchar(100) NOT NULL default ''
249
250
);
250
251
CREATE TABLE t2 (
352
353
--echo #
353
354
create table t1(f1 int);
354
355
insert into t1 values(1),(2),(3);
355
 
create table t2 (key(f1)) engine=myisam select sql_buffer_result f1 from t1;
356
 
check table t2 extended;
 
356
create temporary table t2 (key(f1)) engine=myisam select sql_buffer_result f1 from t1;
 
357
check table t2;
357
358
drop table t1,t2;
358
359
--echo ##################################################################
359
360