~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/insert_select.result

  • Committer: Monty Taylor
  • Date: 2008-10-20 08:48:34 UTC
  • mfrom: (520.1.22 drizzle)
  • Revision ID: monty@inaugust.com-20081020084834-xpb3w01vkcp55o02
Merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
drop table if exists t1,t2,t3;
2
 
create table t1 (bandID MEDIUMINT UNSIGNED NOT NULL PRIMARY KEY, payoutID SMALLINT UNSIGNED NOT NULL);
 
2
create table t1 (bandID INT NOT NULL PRIMARY KEY, payoutID int NOT NULL);
3
3
insert into t1 (bandID,payoutID) VALUES (1,6),(2,6),(3,4),(4,9),(5,10),(6,1),(7,12),(8,12);
4
 
create table t2 (payoutID SMALLINT UNSIGNED NOT NULL PRIMARY KEY);
 
4
create table t2 (payoutID int NOT NULL PRIMARY KEY);
5
5
insert into t2 (payoutID) SELECT DISTINCT payoutID FROM t1;
6
6
insert into t2 (payoutID) SELECT payoutID+10 FROM t1;
7
7
ERROR 23000: Duplicate entry '16' for key 'PRIMARY'
22
22
22
23
23
drop table t1,t2;
24
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,
 
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
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',
 
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
CREATE TABLE `t2` (
40
 
`numeropost` bigint(20) unsigned NOT NULL default '0',
41
 
`icone` tinyint(4) unsigned NOT NULL default '0',
42
 
`numreponse` bigint(20) unsigned NOT NULL auto_increment,
 
40
`numeropost` bigint NOT NULL default '0',
 
41
`icone` int NOT NULL default '0',
 
42
`numreponse` bigint NOT NULL auto_increment,
43
43
`contenu` text NOT NULL,
44
44
`pseudo` varchar(50) NOT NULL default '',
45
45
`date` datetime NOT NULL default '0000-00-00 00:00:00',
46
 
`ip` bigint(11) NOT NULL default '0',
47
 
`signature` tinyint(1) unsigned NOT NULL default '0',
 
46
`ip` bigint NOT NULL default '0',
 
47
`signature` int NOT NULL default '0',
48
48
PRIMARY KEY  (`numeropost`,`numreponse`),
49
49
KEY `ip` (`ip`),
50
50
KEY `date` (`date`),
566
566
a       b
567
567
1       t1:1
568
568
3       t1:3
569
 
2       t2:2
570
569
replace into t1 select * from t2;
571
570
select * from t1;
572
571
a       b
573
572
1       t1:1
 
573
2       t2:2
574
574
3       t2:3
575
 
2       t2:2
576
575
drop table t1,t2;
577
 
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);
578
 
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));
 
576
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);
 
577
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));
579
578
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);
580
579
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;
581
580
drop table t1,t2;
582
581
CREATE TABLE t1(
583
582
Month date NOT NULL,
584
 
Type tinyint(3) unsigned NOT NULL auto_increment,
585
 
Field int(10) unsigned NOT NULL,
586
 
Count int(10) unsigned NOT NULL,
 
583
Type int NOT NULL auto_increment,
 
584
Field int NOT NULL,
 
585
Count int NOT NULL,
 
586
PRIMARY KEY (Type),
587
587
UNIQUE KEY Month (Month,Type,Field)
588
588
);
589
 
insert into t1 Values
590
 
(20030901, 1, 1, 100),
591
 
(20030901, 1, 2, 100),
592
 
(20030901, 2, 1, 100),
593
 
(20030901, 2, 2, 100),
594
 
(20030901, 3, 1, 100);
 
589
insert into t1 Values (20030901, 1, 1, 100);
 
590
insert into t1 Values (20030901, 2, 2, 100);
 
591
insert into t1 Values (20030901, 3, 3, 100);
 
592
insert into t1 Values (20030901, 4, 4, 100);
 
593
insert into t1 Values (20030901, 5, 5, 100);
595
594
select * from t1;
596
595
Month   Type    Field   Count
597
596
2003-09-01      1       1       100
598
 
2003-09-01      1       2       100
599
 
2003-09-01      2       1       100
600
597
2003-09-01      2       2       100
601
 
2003-09-01      3       1       100
 
598
2003-09-01      3       3       100
 
599
2003-09-01      4       4       100
 
600
2003-09-01      5       5       100
602
601
Select null, Field, Count From t1 Where Month=20030901 and Type=2;
603
602
NULL    Field   Count
604
 
NULL    1       100
605
603
NULL    2       100
606
604
create table t2(No int not null, Field int not null, Count int not null);
607
605
insert into t2 Select 0, Field, Count From t1 Where Month=20030901 and Type=2;
608
606
select * from t2;
609
607
No      Field   Count
610
 
0       1       100
611
608
0       2       100
612
609
drop table t1, t2;
613
610
CREATE TABLE t1 (
614
 
ID           int(11) NOT NULL auto_increment,
615
 
NO           int(11) NOT NULL default '0',
616
 
SEQ          int(11) NOT NULL default '0',
 
611
ID           int NOT NULL auto_increment,
 
612
NO           int NOT NULL default '0',
 
613
SEQ          int NOT NULL default '0',
617
614
PRIMARY KEY  (ID),
618
615
KEY t1$NO    (SEQ,NO)
619
616
) ENGINE=MyISAM;
690
687
show status like 'Handler_read%';
691
688
Variable_name   Value
692
689
Handler_read_first      1
693
 
Handler_read_key        0
 
690
Handler_read_key        2
694
691
Handler_read_next       0
695
692
Handler_read_prev       0
696
693
Handler_read_rnd        0
697
694
Handler_read_rnd_next   1
698
695
DROP TABLE t1;
699
696
CREATE TABLE t1 (
700
 
f1 int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
 
697
f1 int NOT NULL auto_increment PRIMARY KEY,
701
698
f2 varchar(100) NOT NULL default ''
702
699
);
703
700
CREATE TABLE t2 (
758
755
ON DUPLICATE KEY UPDATE f1 = 100 + src.f1;
759
756
SELECT * FROM t2;
760
757
f1      f2
761
 
101     1
762
758
2       2
763
759
10      10
 
760
101     1
764
761
DROP TABLE t1, t2;
765
762
CREATE TABLE t1 (
766
763
id INT AUTO_INCREMENT PRIMARY KEY,