mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
131f9a71d1
into xiphis.org:/home/antony/work2/mysql-5.0-merge mysql-test/r/create.result: Auto merged mysql-test/r/federated.result: Auto merged mysql-test/r/insert_select.result: Auto merged mysql-test/r/ps_2myisam.result: Auto merged mysql-test/r/ps_3innodb.result: Auto merged mysql-test/r/ps_4heap.result: Auto merged mysql-test/r/ps_5merge.result: Auto merged mysql-test/r/ps_6bdb.result: Auto merged mysql-test/r/ps_7ndb.result: Auto merged mysql-test/r/strict.result: Auto merged mysql-test/r/view.result: Auto merged mysql-test/r/warnings.result: Auto merged sql/share/errmsg.txt: Auto merged sql/sql_base.cc: Auto merged sql/sql_insert.cc: Auto merged
797 lines
15 KiB
Text
797 lines
15 KiB
Text
drop table if exists t1,t2,t3;
|
|
create table t1 (bandID MEDIUMINT UNSIGNED NOT NULL PRIMARY KEY, payoutID SMALLINT UNSIGNED NOT NULL);
|
|
insert into t1 (bandID,payoutID) VALUES (1,6),(2,6),(3,4),(4,9),(5,10),(6,1),(7,12),(8,12);
|
|
create table t2 (payoutID SMALLINT UNSIGNED NOT NULL PRIMARY KEY);
|
|
insert into t2 (payoutID) SELECT DISTINCT payoutID FROM t1;
|
|
insert into t2 (payoutID) SELECT payoutID+10 FROM t1;
|
|
ERROR 23000: Duplicate entry '16' for key 1
|
|
insert ignore into t2 (payoutID) SELECT payoutID+10 FROM t1;
|
|
select * from t2;
|
|
payoutID
|
|
1
|
|
4
|
|
6
|
|
9
|
|
10
|
|
11
|
|
12
|
|
14
|
|
16
|
|
19
|
|
20
|
|
22
|
|
drop table t1,t2;
|
|
CREATE TABLE `t1` (
|
|
`numeropost` bigint(20) unsigned NOT NULL default '0',
|
|
`icone` tinyint(4) unsigned NOT NULL default '0',
|
|
`numreponse` bigint(20) unsigned NOT NULL auto_increment,
|
|
`contenu` text NOT NULL,
|
|
`pseudo` varchar(50) NOT NULL default '',
|
|
`date` datetime NOT NULL default '0000-00-00 00:00:00',
|
|
`ip` bigint(11) NOT NULL default '0',
|
|
`signature` tinyint(1) unsigned NOT NULL default '0',
|
|
PRIMARY KEY (`numeropost`,`numreponse`)
|
|
,KEY `ip` (`ip`),
|
|
KEY `date` (`date`),
|
|
KEY `pseudo` (`pseudo`),
|
|
KEY `numreponse` (`numreponse`)
|
|
) ENGINE=MyISAM;
|
|
CREATE TABLE `t2` (
|
|
`numeropost` bigint(20) unsigned NOT NULL default '0',
|
|
`icone` tinyint(4) unsigned NOT NULL default '0',
|
|
`numreponse` bigint(20) unsigned NOT NULL auto_increment,
|
|
`contenu` text NOT NULL,
|
|
`pseudo` varchar(50) NOT NULL default '',
|
|
`date` datetime NOT NULL default '0000-00-00 00:00:00',
|
|
`ip` bigint(11) NOT NULL default '0',
|
|
`signature` tinyint(1) unsigned NOT NULL default '0',
|
|
PRIMARY KEY (`numeropost`,`numreponse`),
|
|
KEY `ip` (`ip`),
|
|
KEY `date` (`date`),
|
|
KEY `pseudo` (`pseudo`),
|
|
KEY `numreponse` (`numreponse`)
|
|
) ENGINE=MyISAM;
|
|
INSERT INTO t2
|
|
(numeropost,icone,numreponse,contenu,pseudo,date,ip,signature) VALUES
|
|
(9,1,56,'test','joce','2001-07-25 13:50:53'
|
|
,3649052399,0);
|
|
INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip)
|
|
SELECT 1618,icone,contenu,pseudo,date,signature,ip FROM t2
|
|
WHERE numeropost=9 ORDER BY numreponse ASC;
|
|
show variables like '%bulk%';
|
|
Variable_name Value
|
|
bulk_insert_buffer_size 8388608
|
|
INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip)
|
|
SELECT 1718,icone,contenu,pseudo,date,signature,ip FROM t2
|
|
WHERE numeropost=9 ORDER BY numreponse ASC;
|
|
DROP TABLE t1,t2;
|
|
create table t1 (a int not null);
|
|
create table t2 (a int not null);
|
|
insert into t1 values (1);
|
|
insert into t1 values (a+2);
|
|
insert into t1 values (a+3);
|
|
insert into t1 values (4),(a+5);
|
|
insert into t1 select * from t1;
|
|
select * from t1;
|
|
a
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
insert into t1 select * from t1 as t2;
|
|
select * from t1;
|
|
a
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
insert into t2 select * from t1 as t2;
|
|
select * from t1;
|
|
a
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
insert into t1 select t2.a from t1,t2;
|
|
select * from t1;
|
|
a
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
1
|
|
1
|
|
1
|
|
1
|
|
1
|
|
1
|
|
1
|
|
1
|
|
1
|
|
1
|
|
1
|
|
1
|
|
1
|
|
1
|
|
1
|
|
1
|
|
1
|
|
1
|
|
1
|
|
1
|
|
2
|
|
2
|
|
2
|
|
2
|
|
2
|
|
2
|
|
2
|
|
2
|
|
2
|
|
2
|
|
2
|
|
2
|
|
2
|
|
2
|
|
2
|
|
2
|
|
2
|
|
2
|
|
2
|
|
2
|
|
3
|
|
3
|
|
3
|
|
3
|
|
3
|
|
3
|
|
3
|
|
3
|
|
3
|
|
3
|
|
3
|
|
3
|
|
3
|
|
3
|
|
3
|
|
3
|
|
3
|
|
3
|
|
3
|
|
3
|
|
4
|
|
4
|
|
4
|
|
4
|
|
4
|
|
4
|
|
4
|
|
4
|
|
4
|
|
4
|
|
4
|
|
4
|
|
4
|
|
4
|
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a int not null, b char(10));
|
|
insert into t1 values (1,"t1:1"),(3,"t1:3");
|
|
insert into t2 values (2,"t2:2"), (3,"t2:3");
|
|
insert into t1 select * from t2;
|
|
ERROR 23000: Duplicate entry '3' for key 1
|
|
select * from t1;
|
|
a b
|
|
1 t1:1
|
|
3 t1:3
|
|
2 t2:2
|
|
replace into t1 select * from t2;
|
|
select * from t1;
|
|
a b
|
|
1 t1:1
|
|
3 t2:3
|
|
2 t2:2
|
|
drop table t1,t2;
|
|
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);
|
|
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));
|
|
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);
|
|
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;
|
|
drop table t1,t2;
|
|
CREATE TABLE t1(
|
|
Month date NOT NULL,
|
|
Type tinyint(3) unsigned NOT NULL auto_increment,
|
|
Field int(10) unsigned NOT NULL,
|
|
Count int(10) unsigned NOT NULL,
|
|
UNIQUE KEY Month (Month,Type,Field)
|
|
);
|
|
insert into t1 Values
|
|
(20030901, 1, 1, 100),
|
|
(20030901, 1, 2, 100),
|
|
(20030901, 2, 1, 100),
|
|
(20030901, 2, 2, 100),
|
|
(20030901, 3, 1, 100);
|
|
select * from t1;
|
|
Month Type Field Count
|
|
2003-09-01 1 1 100
|
|
2003-09-01 1 2 100
|
|
2003-09-01 2 1 100
|
|
2003-09-01 2 2 100
|
|
2003-09-01 3 1 100
|
|
Select null, Field, Count From t1 Where Month=20030901 and Type=2;
|
|
NULL Field Count
|
|
NULL 1 100
|
|
NULL 2 100
|
|
create table t2(No int not null, Field int not null, Count int not null);
|
|
insert into t2 Select null, Field, Count From t1 Where Month=20030901 and Type=2;
|
|
Warnings:
|
|
Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'No' at row 1
|
|
Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'No' at row 2
|
|
select * from t2;
|
|
No Field Count
|
|
0 1 100
|
|
0 2 100
|
|
drop table t1, t2;
|
|
CREATE TABLE t1 (
|
|
ID int(11) NOT NULL auto_increment,
|
|
NO int(11) NOT NULL default '0',
|
|
SEQ int(11) NOT NULL default '0',
|
|
PRIMARY KEY (ID),
|
|
KEY t1$NO (SEQ,NO)
|
|
) ENGINE=MyISAM;
|
|
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);
|
|
select SQL_BUFFER_RESULT * from t1 WHERE (SEQ = 1);
|
|
ID NO SEQ
|
|
1 1 1
|
|
drop table t1;
|
|
create table t1 (f1 int);
|
|
create table t2 (ff1 int unique, ff2 int default 1);
|
|
insert into t1 values (1),(1),(2);
|
|
insert into t2(ff1) select f1 from t1 on duplicate key update ff2=ff2+1;
|
|
select * from t2;
|
|
ff1 ff2
|
|
1 2
|
|
2 1
|
|
drop table t1, t2;
|
|
create table t1 (a int unique);
|
|
create table t2 (a int, b int);
|
|
create table t3 (c int, d int);
|
|
insert into t1 values (1),(2);
|
|
insert into t2 values (1,2);
|
|
insert into t3 values (1,6),(3,7);
|
|
select * from t1;
|
|
a
|
|
1
|
|
2
|
|
insert into t1 select a from t2 on duplicate key update a= t1.a + t2.b;
|
|
select * from t1;
|
|
a
|
|
2
|
|
3
|
|
insert into t1 select a+1 from t2 on duplicate key update t1.a= t1.a + t2.b+1;
|
|
select * from t1;
|
|
a
|
|
3
|
|
5
|
|
insert into t1 select t3.c from t3 on duplicate key update a= a + t3.d;
|
|
select * from t1;
|
|
a
|
|
1
|
|
5
|
|
10
|
|
insert into t1 select t2.a from t2 group by t2.a on duplicate key update a= a + 10;
|
|
insert into t1 select t2.a from t2 on duplicate key update a= a + t2.b;
|
|
ERROR 23000: Column 'a' in field list is ambiguous
|
|
insert into t1 select t2.a from t2 on duplicate key update t2.a= a + t2.b;
|
|
ERROR 42S22: Unknown column 't2.a' in 'field list'
|
|
insert into t1 select t2.a from t2 group by t2.a on duplicate key update a= t1.a + t2.b;
|
|
ERROR 42S22: Unknown column 't2.b' in 'field list'
|
|
drop table t1,t2,t3;
|
|
create table t1(f1 varchar(5) key);
|
|
insert into t1(f1) select if(max(f1) is null, '2000',max(f1)+1) from t1;
|
|
insert into t1(f1) select if(max(f1) is null, '2000',max(f1)+1) from t1;
|
|
insert into t1(f1) select if(max(f1) is null, '2000',max(f1)+1) from t1;
|
|
select * from t1;
|
|
f1
|
|
2000
|
|
2001
|
|
2002
|
|
drop table t1;
|
|
create table t1(x int, y int);
|
|
create table t2(x int, z int);
|
|
insert into t1(x,y) select x,z from t2 on duplicate key update x=values(x);
|
|
insert into t1(x,y) select x,z from t2 on duplicate key update x=values(z);
|
|
ERROR 42S22: Unknown column 'z' in 'field list'
|
|
insert into t1(x,y) select x,z from t2 on duplicate key update x=values(t2.x);
|
|
ERROR 42S22: Unknown column 't2.x' in 'field list'
|
|
drop table t1,t2;
|
|
CREATE TABLE t1 (a int PRIMARY KEY);
|
|
INSERT INTO t1 values (1), (2);
|
|
INSERT INTO t1 SELECT a + 2 FROM t1 LIMIT 1;
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1 (x int, y int);
|
|
CREATE TABLE t2 (z int, y int);
|
|
CREATE TABLE t3 (a int, b int);
|
|
INSERT INTO t3 (SELECT x, y FROM t1 JOIN t2 USING (y) WHERE z = 1);
|
|
DROP TABLE IF EXISTS t1,t2,t3;
|
|
CREATE DATABASE meow;
|
|
CREATE TABLE table_target ( mexs_id CHAR(8), messzeit TIMESTAMP, PRIMARY KEY (mexs_id));
|
|
CREATE TABLE table_target2 ( mexs_id CHAR(8), messzeit TIMESTAMP, PRIMARY KEY (mexs_id));
|
|
CREATE TABLE table_target3 ( mexs_id CHAR(8), messzeit TIMESTAMP, PRIMARY KEY (mexs_id));
|
|
CREATE VIEW view_target2 AS SELECT mexs_id,messzeit FROM table_target2;
|
|
CREATE SQL SECURITY INVOKER VIEW view_target3 AS SELECT mexs_id,messzeit FROM table_target3;
|
|
CREATE TABLE table_stations ( mexs_id VARCHAR(8), icao VARCHAR(4), country CHAR(2), PRIMARY KEY (mexs_id), UNIQUE KEY icao (icao), KEY country (country), CONSTRAINT stations_ibfk_8 FOREIGN KEY (country) REFERENCES countries (country) ON UPDATE CASCADE);
|
|
INSERT INTO table_stations VALUES ('87654321','XXXX','YY');
|
|
CREATE TABLE table_countries ( country CHAR(2), iso_short_en VARCHAR(64), PRIMARY KEY (country));
|
|
INSERT INTO table_countries VALUES ('YY','Entenhausen');
|
|
CREATE ALGORITHM=MERGE SQL SECURITY INVOKER VIEW view_stations AS select table_stations.mexs_id AS mexs_id, table_stations.icao AS icao, table_stations.country AS landescode from (table_stations join table_countries on((table_stations.country = table_countries.country)));
|
|
CREATE TABLE table_source ( id varchar(4), datetime TIMESTAMP, PRIMARY KEY (id));
|
|
INSERT INTO table_source VALUES ('XXXX','2006-07-12 07:50:00');
|
|
GRANT SELECT ON table_source TO user20989@localhost;
|
|
GRANT SELECT ON table_countries TO user20989@localhost;
|
|
GRANT SELECT ON table_stations TO user20989@localhost;
|
|
GRANT SELECT ON view_stations TO user20989@localhost;
|
|
GRANT SELECT ON table_target TO user20989@localhost;
|
|
GRANT SELECT ON table_target2 TO user20989@localhost;
|
|
GRANT INSERT,DELETE,SELECT ON view_target3 TO user20989@localhost;
|
|
REPLACE INTO table_target
|
|
SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
|
|
FROM table_source
|
|
INNER JOIN view_stations AS stations
|
|
ON table_source.id = stations.icao
|
|
LEFT JOIN table_target AS old
|
|
USING (mexs_id);
|
|
ERROR 42000: INSERT,DELETE command denied to user 'user20989'@'localhost' for table 'table_target'
|
|
REPLACE INTO view_target2
|
|
SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
|
|
FROM table_source
|
|
INNER JOIN view_stations AS stations
|
|
ON table_source.id = stations.icao
|
|
LEFT JOIN view_target2 AS old
|
|
USING (mexs_id);
|
|
ERROR 42000: INSERT,DELETE command denied to user 'user20989'@'localhost' for table 'view_target2'
|
|
REPLACE INTO view_target3
|
|
SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
|
|
FROM table_source
|
|
INNER JOIN view_stations AS stations
|
|
ON table_source.id = stations.icao
|
|
LEFT JOIN view_target3 AS old
|
|
USING (mexs_id);
|
|
ERROR HY000: View 'meow.view_target3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
|
GRANT INSERT,DELETE ON table_target TO user20989@localhost;
|
|
GRANT INSERT,DELETE,SELECT ON view_target2 TO user20989@localhost;
|
|
GRANT INSERT,DELETE,SELECT ON table_target3 TO user20989@localhost;
|
|
REPLACE INTO table_target
|
|
SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
|
|
FROM table_source
|
|
INNER JOIN view_stations AS stations
|
|
ON table_source.id = stations.icao
|
|
LEFT JOIN table_target AS old
|
|
USING (mexs_id);
|
|
REPLACE INTO table_target2 VALUES ('00X45Y78','2006-07-12 07:50:00');
|
|
ERROR 42000: INSERT,DELETE command denied to user 'user20989'@'localhost' for table 'table_target2'
|
|
REPLACE INTO view_target2 VALUES ('12X45Y78','2006-07-12 07:50:00');
|
|
SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
|
|
FROM table_source
|
|
INNER JOIN view_stations AS stations
|
|
ON table_source.id = stations.icao
|
|
LEFT JOIN view_target2 AS old
|
|
USING (mexs_id);
|
|
mexs_id messzeit
|
|
87654321 2006-07-12 07:50:00
|
|
REPLACE INTO view_target2
|
|
SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
|
|
FROM table_source
|
|
INNER JOIN view_stations AS stations
|
|
ON table_source.id = stations.icao
|
|
LEFT JOIN view_target2 AS old
|
|
USING (mexs_id);
|
|
REPLACE INTO view_target3
|
|
SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
|
|
FROM table_source
|
|
INNER JOIN view_stations AS stations
|
|
ON table_source.id = stations.icao
|
|
LEFT JOIN view_target3 AS old
|
|
USING (mexs_id);
|
|
SELECT * FROM table_target;
|
|
mexs_id messzeit
|
|
87654321 2006-07-12 07:50:00
|
|
SELECT * FROM view_target2;
|
|
mexs_id messzeit
|
|
12X45Y78 2006-07-12 07:50:00
|
|
87654321 2006-07-12 07:50:00
|
|
SELECT * FROM view_target3;
|
|
mexs_id messzeit
|
|
87654321 2006-07-12 07:50:00
|
|
DROP VIEW view_stations;
|
|
DROP TABLE table_source;
|
|
DROP TABLE table_countries;
|
|
DROP TABLE table_stations;
|
|
DROP TABLE table_target;
|
|
DROP TABLE table_target2;
|
|
DROP TABLE table_target3;
|
|
DROP VIEW view_target2;
|
|
DROP VIEW view_target3;
|
|
DROP USER user20989@localhost;
|
|
DROP DATABASE meow;
|