6
6
drop table if exists t1,t2,t3;
9
create table t1 (bandID MEDIUMINT NOT NULL PRIMARY KEY, payoutID int NOT NULL);
9
create table t1 (bandID MEDIUMINT UNSIGNED NOT NULL PRIMARY KEY, payoutID SMALLINT UNSIGNED 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 int NOT NULL PRIMARY KEY);
11
create table t2 (payoutID SMALLINT UNSIGNED 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;
24
24
CREATE TABLE `t1` (
25
`numeropost` bigint(20) NOT NULL default '0',
26
`icone` int(4) NOT NULL default '0',
27
`numreponse` bigint(20) NOT NULL auto_increment,
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,
28
28
`contenu` text NOT NULL,
29
29
`pseudo` varchar(50) NOT NULL default '',
30
30
`date` datetime NOT NULL default '0000-00-00 00:00:00',
31
31
`ip` bigint(11) NOT NULL default '0',
32
`signature` int(1) NOT NULL default '0',
32
`signature` tinyint(1) unsigned NOT NULL default '0',
33
33
PRIMARY KEY (`numeropost`,`numreponse`)
35
35
KEY `date` (`date`),
40
40
CREATE TABLE `t2` (
41
`numeropost` bigint(20) NOT NULL default '0',
42
`icone` int(4) NOT NULL default '0',
43
`numreponse` bigint(20) NOT NULL auto_increment,
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,
44
44
`contenu` text NOT NULL,
45
45
`pseudo` varchar(50) NOT NULL default '',
46
46
`date` datetime NOT NULL default '0000-00-00 00:00:00',
47
47
`ip` bigint(11) NOT NULL default '0',
48
`signature` int(1) NOT NULL default '0',
48
`signature` tinyint(1) unsigned NOT NULL default '0',
49
49
PRIMARY KEY (`numeropost`,`numreponse`),
51
51
KEY `date` (`date`),
113
113
# Test that caused uninitialized memory access in auto_increment_key update
116
CREATE TABLE t1 ( USID INTEGER UNSIGNED, ServerID int 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 int UNSIGNED, AccessRequestTime DATETIME, AcctStartTime DATETIME, AcctLastTime DATETIME, LastModification TIMESTAMP NOT NULL);
117
CREATE TABLE t2 ( USID INTEGER AUTO_INCREMENT, ServerID int 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 int UNSIGNED, AccessRequestTime DATETIME, AcctStartTime DATETIME, AcctLastTime DATETIME, LastModification TIMESTAMP NOT NULL, INDEX(USID,ServerID,NASAddr,SessionID), INDEX(AssignedAddr));
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));
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;