2005-06-27 15:46:41 +02:00
|
|
|
drop table if exists t1,t2,t3;
|
2001-09-28 07:05:54 +02:00
|
|
|
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;
|
2006-01-23 12:17:05 +01:00
|
|
|
ERROR 23000: Duplicate entry '16' for key 'PRIMARY'
|
2001-11-08 13:17:56 +01:00
|
|
|
insert ignore into t2 (payoutID) SELECT payoutID+10 FROM t1;
|
2012-09-18 14:14:19 +02:00
|
|
|
Warnings:
|
|
|
|
Warning 1062 Duplicate entry '16' for key 'PRIMARY'
|
|
|
|
Warning 1062 Duplicate entry '16' for key 'PRIMARY'
|
|
|
|
Warning 1062 Duplicate entry '22' for key 'PRIMARY'
|
2001-09-28 07:05:54 +02:00
|
|
|
select * from t2;
|
2000-12-28 02:56:38 +01:00
|
|
|
payoutID
|
|
|
|
1
|
|
|
|
4
|
|
|
|
6
|
|
|
|
9
|
|
|
|
10
|
|
|
|
11
|
|
|
|
12
|
|
|
|
14
|
|
|
|
16
|
|
|
|
19
|
|
|
|
20
|
|
|
|
22
|
2001-09-28 07:05:54 +02:00
|
|
|
drop table t1,t2;
|
2003-01-06 00:48:59 +01:00
|
|
|
CREATE TABLE `t1` (
|
2001-09-28 07:05:54 +02:00
|
|
|
`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`)
|
2003-12-10 05:31:42 +01:00
|
|
|
) ENGINE=MyISAM;
|
2003-01-06 00:48:59 +01:00
|
|
|
CREATE TABLE `t2` (
|
2001-09-28 07:05:54 +02:00
|
|
|
`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`)
|
2003-12-10 05:31:42 +01:00
|
|
|
) ENGINE=MyISAM;
|
2003-01-06 00:48:59 +01:00
|
|
|
INSERT INTO t2
|
2001-09-28 07:05:54 +02:00
|
|
|
(numeropost,icone,numreponse,contenu,pseudo,date,ip,signature) VALUES
|
|
|
|
(9,1,56,'test','joce','2001-07-25 13:50:53'
|
|
|
|
,3649052399,0);
|
2003-01-06 00:48:59 +01:00
|
|
|
INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip)
|
|
|
|
SELECT 1618,icone,contenu,pseudo,date,signature,ip FROM t2
|
2001-09-28 07:05:54 +02:00
|
|
|
WHERE numeropost=9 ORDER BY numreponse ASC;
|
|
|
|
show variables like '%bulk%';
|
2001-07-26 15:57:34 +02:00
|
|
|
Variable_name Value
|
2002-07-23 17:31:22 +02:00
|
|
|
bulk_insert_buffer_size 8388608
|
2003-01-06 00:48:59 +01:00
|
|
|
INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip)
|
|
|
|
SELECT 1718,icone,contenu,pseudo,date,signature,ip FROM t2
|
2001-09-28 07:05:54 +02:00
|
|
|
WHERE numeropost=9 ORDER BY numreponse ASC;
|
2003-08-18 23:08:08 +02:00
|
|
|
DROP TABLE t1,t2;
|
2003-07-01 23:10:47 +02:00
|
|
|
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
|
|
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4
|
|
|
|
4
|
|
|
|
4
|
|
|
|
4
|
|
|
|
4
|
|
|
|
5
|
|
|
|
5
|
|
|
|
5
|
|
|
|
5
|
|
|
|
5
|
|
|
|
5
|
|
|
|
5
|
|
|
|
5
|
|
|
|
5
|
|
|
|
5
|
|
|
|
5
|
|
|
|
5
|
|
|
|
5
|
|
|
|
5
|
|
|
|
5
|
|
|
|
5
|
|
|
|
5
|
|
|
|
5
|
|
|
|
5
|
|
|
|
5
|
2003-07-03 10:55:36 +02:00
|
|
|
insert into t1 select * from t1,t1;
|
2003-08-18 23:08:08 +02:00
|
|
|
ERROR 42000: Not unique table/alias: 't1'
|
2003-07-03 10:55:36 +02:00
|
|
|
drop table t1,t2;
|
|
|
|
create table t1 (a int not null primary key, b char(10));
|
|
|
|
create table t2 (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;
|
2006-01-23 12:17:05 +01:00
|
|
|
ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
|
2003-07-03 10:55:36 +02:00
|
|
|
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
|
|
|
|
2 t2:2
|
2012-02-29 21:55:04 +01:00
|
|
|
3 t2:3
|
2003-07-01 23:10:47 +02:00
|
|
|
drop table t1,t2;
|
2003-07-18 03:04:24 +02:00
|
|
|
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;
|
2004-02-06 14:40:44 +01:00
|
|
|
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;
|
2003-12-16 22:55:34 +01:00
|
|
|
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
|
2004-02-06 14:40:44 +01:00
|
|
|
Select null, Field, Count From t1 Where Month=20030901 and Type=2;
|
2003-12-16 22:55:34 +01:00
|
|
|
NULL Field Count
|
|
|
|
NULL 1 100
|
|
|
|
NULL 2 100
|
2004-02-06 14:40:44 +01:00
|
|
|
create table t2(No int not null, Field int not null, Count int not null);
|
2017-02-08 21:28:00 +01:00
|
|
|
insert ignore into t2 Select null, Field, Count From t1 Where Month=20030901 and Type=2;
|
After merge fixes
Added more DBUG statements
Ensure that we are comparing end space with BINARY strings
Use 'any_db' instead of '' to mean any database. (For HANDLER command)
Only strip ' ' when comparing CHAR, not other space-like characters (like \t)
BitKeeper/deleted/.del-ctype_tis620.result-old~3578ceb0b8284685:
Delete: mysql-test/r/ctype_tis620.result-old
BitKeeper/deleted/.del-ctype_tis620.test-old~ffb1bbd2935d1aba:
Delete: mysql-test/t/ctype_tis620.test-old
client/mysqlbinlog.cc:
Added DBUG statements
Added call of my_end() to free all used memory on exit
heap/hp_info.c:
After merge fixes
heap/hp_open.c:
After merge fixes
include/heap.h:
After merge fixes
include/m_ctype.h:
Use pchar instead of 'int' for character parameters.
Added 'my_binary_compare()'
include/m_string.h:
Fixed wrong define
innobase/ibuf/ibuf0ibuf.c:
After merge fixes
innobase/srv/srv0start.c:
After merge fixes
mysql-test/r/alter_table.result:
Fixed results after merge
mysql-test/r/auto_increment.result:
Fixed results after merge
mysql-test/r/bdb.result:
Fixed results after merge
mysql-test/r/binary.result:
Fixed results after merge
mysql-test/r/create.result:
Fixed results after merge
mysql-test/r/ctype_mb.result:
Fixed results after merge
mysql-test/r/ctype_tis620.result:
Fixed results after merge
mysql-test/r/ctype_utf8.result:
Fixed results after merge
mysql-test/r/delete.result:
Fixed results after merge
mysql-test/r/func_compress.result:
Fixed results after merge
mysql-test/r/func_gconcat.result:
Fixed results after merge
mysql-test/r/func_group.result:
Fixed results after merge
mysql-test/r/func_str.result:
Fixed results after merge
mysql-test/r/innodb.result:
Fixed results after merge
mysql-test/r/insert.result:
Fixed results after merge
mysql-test/r/insert_select.result:
Fixed results after merge
mysql-test/r/key.result:
Fixed results after merge
mysql-test/r/loaddata.result:
Fixed results after merge
mysql-test/r/lock.result:
Fixed results after merge
mysql-test/r/myisam.result:
Fixed results after merge
mysql-test/r/null.result:
Fixed results after merge
mysql-test/r/null_key.result:
Fixed results after merge
mysql-test/r/order_by.result:
Fixed results after merge
mysql-test/r/query_cache.result:
Fixed results after merge
mysql-test/r/range.result:
Fixed results after merge
mysql-test/r/rpl_multi_delete.result:
Fixed results after merge
mysql-test/r/rpl_until.result:
Fixed results after merge
mysql-test/r/subselect.result:
Fixed results after merge
mysql-test/r/subselect_innodb.result:
Fixed results after merge
mysql-test/r/type_blob.result:
Fixed results after merge
mysql-test/r/type_datetime.result:
Fixed results after merge
mysql-test/r/type_decimal.result:
Fixed results after merge
mysql-test/r/type_enum.result:
Fixed results after merge
mysql-test/r/type_float.result:
Fixed results after merge
mysql-test/r/type_ranges.result:
Fixed results after merge
mysql-test/r/type_time.result:
Fixed results after merge
mysql-test/r/type_timestamp.result:
Fixed results after merge
mysql-test/r/type_uint.result:
Fixed results after merge
mysql-test/r/type_year.result:
Fixed results after merge
mysql-test/r/variables.result:
Fixed results after merge
mysql-test/r/warnings.result:
Fixed results after merge
mysql-test/t/case.test:
Fixed shifted error messages
mysql-test/t/create.test:
Fixed shifted error messages
mysql-test/t/ctype_collate.test:
Fixed shifted error messages
mysql-test/t/ctype_tis620.test:
Merge with 4.0 ctype_tis620 test
mysql-test/t/delete.test:
Fixed shifted error messages
mysql-test/t/derived.test:
Fixed shifted error messages
mysql-test/t/fulltext.test:
Fixed shifted error messages
mysql-test/t/func_in.test:
Fixed shifted error messages
mysql-test/t/func_str.test:
Fixed shifted error messages
mysql-test/t/func_test.test:
Fixed shifted error messages
mysql-test/t/grant.test:
Fixed shifted error messages
mysql-test/t/innodb.test:
Change to 4.1 syntax
mysql-test/t/key_cache.test:
Fixed shifted error messages
mysql-test/t/myisam.test:
New test of blob and end space
mysql-test/t/row.test:
Fixed shifted error messages
mysql-test/t/rpl_until.test:
Fixed shifted error messages
mysql-test/t/subselect.test:
Fixed shifted error messages
mysql-test/t/subselect_innodb.test:
Fix test to take into account foreign key constraints
mysql-test/t/union.test:
Fixed shifted error messages
mysql-test/t/user_var.test:
Fixed shifted error messages
mysql-test/t/variables.test:
Fixed shifted error messages
mysys/my_handler.c:
Merge with 4.0 code
sql/ha_heap.cc:
After merge fixes
sql/handler.cc:
After merge fixes
sql/item.cc:
After merge fixes
sql/item_cmpfunc.cc:
Ensure that we are comparing end space with BINARY strings
sql/item_cmpfunc.h:
Ensure that we are comparing end space with BINARY strings
sql/log_event.cc:
More DBUG statements
Ensure that we use all options to LOAD DATA in replication
sql/opt_range.cc:
After merge fixes
sql/sql_db.cc:
After merge fixes
sql/sql_handler.cc:
After merge fixes
Use 'any_db' instead of '' to mean 'no database comparison'
sql/sql_parse.cc:
After merge fixes
sql/sql_select.cc:
After merge fixes
Added function comment for setup_group()
sql/sql_string.cc:
Added stringcmp() for binary comparison.
Added function comments for sortcmp() and stringcmp()
sql/sql_string.h:
Added stringcmp()
sql/sql_table.cc:
After merge fixes
sql/sql_update.cc:
After merge fixes
sql/sql_yacc.yy:
Use 'any_db' instead of '' to mean any database. Using "" causes a 'wrong db name' error.
strings/ctype-big5.c:
Strip only end space, not other space characters.
strings/ctype-bin.c:
Removed some not needed functions.
Added function comments
Don't remove end space in comparisons
Change my_wildcmp_bin() to be 'identical' with other similar code
strings/ctype-czech.c:
Strip only end space, not other space characters.
strings/ctype-gbk.c:
Strip only end space, not other space characters.
strings/ctype-latin1.c:
Strip only end space, not other space characters.
strings/ctype-mb.c:
Strip only end space, not other space characters.
strings/ctype-simple.c:
Strip only end space, not other space characters.
strings/ctype-sjis.c:
Strip only end space, not other space characters.
strings/ctype-tis620.c:
Added usage of my_instr_simple. This needs to be cleaned up!
strings/ctype-utf8.c:
Strip only end space, not other space characters.
strings/ctype-win1250ch.c:
Strip only end space, not other space characters.
Fixed indentation
strings/strto.c:
Code cleanup
2004-02-16 09:03:25 +01:00
|
|
|
Warnings:
|
Fix for bug#11491 Misleading error message if not NULL column set to NULL,
SQL mode TRADITIONAL
Message is chenged from 'ER_WARN_NULL_TO_NOTNULL' to 'ER_BAD_NULL_ERROR'
mysql-test/r/auto_increment.result:
Fix for bug#11491 Misleading error message if not NULL column set to NULL,
SQL mode TRADITIONAL
result change
mysql-test/r/create.result:
Fix for bug#11491 Misleading error message if not NULL column set to NULL,
SQL mode TRADITIONAL
result change
mysql-test/r/insert.result:
Fix for bug#11491 Misleading error message if not NULL column set to NULL,
SQL mode TRADITIONAL
result change
mysql-test/r/insert_select.result:
Fix for bug#11491 Misleading error message if not NULL column set to NULL,
SQL mode TRADITIONAL
result change
mysql-test/r/key.result:
Fix for bug#11491 Misleading error message if not NULL column set to NULL,
SQL mode TRADITIONAL
result change
mysql-test/r/null.result:
Fix for bug#11491 Misleading error message if not NULL column set to NULL,
SQL mode TRADITIONAL
result change
mysql-test/r/null_key.result:
Fix for bug#11491 Misleading error message if not NULL column set to NULL,
SQL mode TRADITIONAL
result change
mysql-test/r/ps_2myisam.result:
Fix for bug#11491 Misleading error message if not NULL column set to NULL,
SQL mode TRADITIONAL
result change
mysql-test/r/ps_3innodb.result:
Fix for bug#11491 Misleading error message if not NULL column set to NULL,
SQL mode TRADITIONAL
result change
mysql-test/r/ps_4heap.result:
Fix for bug#11491 Misleading error message if not NULL column set to NULL,
SQL mode TRADITIONAL
result change
mysql-test/r/ps_5merge.result:
Fix for bug#11491 Misleading error message if not NULL column set to NULL,
SQL mode TRADITIONAL
result change
mysql-test/r/ps_6bdb.result:
Fix for bug#11491 Misleading error message if not NULL column set to NULL,
SQL mode TRADITIONAL
result change
mysql-test/r/ps_7ndb.result:
Fix for bug#11491 Misleading error message if not NULL column set to NULL,
SQL mode TRADITIONAL
result change
mysql-test/r/strict.result:
Fix for bug#11491 Misleading error message if not NULL column set to NULL,
SQL mode TRADITIONAL
result change
mysql-test/r/view.result:
Fix for bug#11491 Misleading error message if not NULL column set to NULL,
SQL mode TRADITIONAL
result change
mysql-test/r/warnings.result:
Fix for bug#11491 Misleading error message if not NULL column set to NULL,
SQL mode TRADITIONAL
result change
mysql-test/t/strict.test:
Fix for bug#11491 Misleading error message if not NULL column set to NULL,
SQL mode TRADITIONAL
test change
2005-12-01 12:30:11 +01:00
|
|
|
Warning 1048 Column 'No' cannot be null
|
|
|
|
Warning 1048 Column 'No' cannot be null
|
2004-02-06 14:40:44 +01:00
|
|
|
select * from t2;
|
2003-12-16 22:55:34 +01:00
|
|
|
No Field Count
|
|
|
|
0 1 100
|
|
|
|
0 2 100
|
2004-02-06 14:40:44 +01:00
|
|
|
drop table t1, t2;
|
2005-02-16 17:34:02 +01:00
|
|
|
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;
|
2005-06-21 20:24:58 +02:00
|
|
|
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;
|
2005-06-22 05:18:42 +02:00
|
|
|
create table t1 (a int unique);
|
|
|
|
create table t2 (a int, b int);
|
2005-06-27 15:46:41 +02:00
|
|
|
create table t3 (c int, d int);
|
2005-06-22 05:18:42 +02:00
|
|
|
insert into t1 values (1),(2);
|
|
|
|
insert into t2 values (1,2);
|
2005-06-27 15:46:41 +02:00
|
|
|
insert into t3 values (1,6),(3,7);
|
2005-06-22 05:18:42 +02:00
|
|
|
select * from t1;
|
|
|
|
a
|
|
|
|
1
|
|
|
|
2
|
2005-06-27 15:46:41 +02:00
|
|
|
insert into t1 select a from t2 on duplicate key update a= t1.a + t2.b;
|
2005-06-22 05:18:42 +02:00
|
|
|
select * from t1;
|
|
|
|
a
|
|
|
|
2
|
|
|
|
3
|
2005-06-27 15:46:41 +02:00
|
|
|
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;
|
Implementation of WL#2486 -
"Process NATURAL and USING joins according to SQL:2003".
* Some of the main problems fixed by the patch:
- in "select *" queries the * expanded correctly according to
ANSI for arbitrary natural/using joins
- natural/using joins are correctly transformed into JOIN ... ON
for any number/nesting of the joins.
- column references are correctly resolved against natural joins
of any nesting and combined with arbitrary other joins.
* This patch also contains a fix for name resolution of items
inside the ON condition of JOIN ... ON - in this case items must
be resolved only against the JOIN operands. To support such
'local' name resolution, the patch introduces a stack of
name resolution contexts used at parse time.
NOTICE:
- This patch is not complete in the sense that
- there are 2 test cases that still do not pass -
one in join.test, one in select.test. Both are marked
with a comment "TODO: WL#2486".
- it does not include a new test specific for the task
mysql-test/include/ps_query.inc:
Adjusted according to standard NATURAL/USING join semantics.,
mysql-test/r/bdb.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/derived.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/errors.result:
The column as a whole cannot be resolved, so different error message.
mysql-test/r/fulltext.result:
Adjusted according to standard JOIN ... ON semantics =>
the ON condition can refer only to the join operands.
mysql-test/r/fulltext_order_by.result:
More detailed error message.
mysql-test/r/innodb.result:
Adjusted according to standard NATURAL/USING join semantics.
This test doesn't pass completetly yet!
mysql-test/r/insert_select.result:
More detailed error message.
mysql-test/r/join.result:
Adjusted according to standard NATURAL/USING join semantics.
NOTICE: there is one test case that still fails, and it is
commeted out and marked with WL#2486 in the test file.
mysql-test/r/join_crash.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/join_nested.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/join_outer.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/multi_update.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/null_key.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/order_by.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/ps_2myisam.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/ps_3innodb.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/ps_4heap.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/ps_5merge.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/ps_6bdb.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/ps_7ndb.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/select.result:
Adjusted according to standard NATURAL/USING join semantics.
NOTICE: there is one failing test case which is commented with
WL#2486 in the test file.
mysql-test/r/subselect.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/type_ranges.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/union.result:
More detailed error message.
mysql-test/t/bdb.test:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/t/errors.test:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/t/fulltext.test:
Adjusted according to standard JOIN ... ON semantics =>
the ON condition can refer only to the join operands.
mysql-test/t/fulltext_order_by.test:
More detailed error message.
mysql-test/t/innodb.test:
Adjusted according to standard NATURAL/USING join semantics.
This test doesn't pass completetly yet!
mysql-test/t/insert_select.test:
More detailed error message.
mysql-test/t/join.test:
Adjusted according to standard NATURAL/USING join semantics.
NOTICE: there is one test case that still fails, and it is
commeted out and marked with WL#2486 in the test file.
mysql-test/t/join_crash.test:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/t/join_nested.test:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/t/join_outer.test:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/t/null_key.test:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/t/order_by.test:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/t/select.test:
Adjusted according to standard NATURAL/USING join semantics.
NOTICE: there is one test case that still fails, and it is
commeted out and marked with WL#2486 in the test file.
mysql-test/t/subselect.test:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/t/type_ranges.test:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/t/union.test:
More detailed error message.
sql/item.cc:
- extra parameter to find_field_in_tables
- find_field_in_real_table renamed to find_field_in_table
- fixed comments/typos
sql/item.h:
- added [first | last]_name_resolution_table to class
Name_resolution_context
- commented old code
- standardized formatting
sql/mysql_priv.h:
- refactored the find_field_in_XXX procedures,
- added a new procedure for natural join table references,
- renamed the find_field_in_XXX procedures to clearer names
sql/sp.cc:
- pass the top-most list of the FROM clause to setup_tables
- extra parameter to find_field_in_tables
sql/sql_acl.cc:
- renamed find_field_in_table => find_field_in_table_ref
- extra parameter to find_field_in_table_ref
- commented old code
sql/sql_base.cc:
This file contains the core of the implementation of the processing
of NATURAL/USING joins (WL#2486).
- added many comments to old code
- refactored the group of find_field_in_XXX procedures, and added a
new procedure for natural joins. There is one find_field_in_XXX procedure
per each type of table reference (stored table, merge view, or natural
join); one meta-procedure that selects the correct one depeneding on the
table reference; and one procedure that goes over a list of table
referenes.
- NATURAL/USING joins are processed through the procedures:
mark_common_columns, store_natural_using_join_columns,
store_top_level_join_columns, setup_natural_join_row_types.
The entry point to processing NATURAL/USING joins is the
procedure 'setup_natural_join_row_types'.
- Replaced the specialized Field_iterator_XXX iterators with one
generic iterator over the fields of a table reference.
- Simplified 'insert_fields' and 'setup_conds' due to encapsulation of
the processing of natural joins in a separate set of procedures.
sql/sql_class.h:
- Commented old code.
sql/sql_delete.cc:
- Pass the FROM clause to setup_tables.
sql/sql_help.cc:
- pass the end name resolution table to find_field_in_tables
- adjust the list of tables for name resolution
sql/sql_insert.cc:
- Changed the code that saves and restores the current context to
support the list of tables for name resolution -
context->first_name_resolution_table, and
table_list->next_name_resolution_table.
Needed to support an ugly trick to resolve inserted columns only in
the first table.
- Added Name_resolution_context::[first | last]_name_resolution_table.
- Commented old code
sql/sql_lex.cc:
- set select_lex.parent_lex correctly
- set correct state of the current name resolution context
sql/sql_lex.h:
- Added a stack of name resolution contexts to support local
contexts for JOIN ... ON conditions.
- Commented old code.
sql/sql_load.cc:
- Pass the FROM clause to setup_tables.
sql/sql_olap.cc:
- Pass the FROM clause to setup_tables.
sql/sql_parse.cc:
- correctly set SELECT_LEX::parent_lex
- set the first table of the current name resoltion context
- added support for NATURAL/USING joins
- commented old code
sql/sql_select.cc:
- Pass the FROM clause to setup_tables.
- Pass the end table to find_field_in_tables
- Improved comments
sql/sql_show.cc:
- Set SELECT_LEX::parent_lex.
sql/sql_update.cc:
- Pass the FROM clause to setup_tables.
sql/sql_yacc.yy:
- Added support for a stack of name resolution contexts needed to
implement name resolution for JOIN ... ON. A context is pushed
for each new JOIN ... ON, and popped afterwards.
- Added support for NATURAL/USING joins.
sql/table.cc:
- Added new class Natural_join_column to hide the heterogeneous
representation of column references for stored tables and for
views.
- Added a new list TABLE_LIST::next_name_resolution_table to
support name resolution with NATURAL/USING joins. Also added
other members to TABLE_LIST to support NATURAL/USING joins.
- Added a generic iterator over the fields of table references
of various types - class Field_iterator_table_ref
sql/table.h:
- Added new class Natural_join_column to hide the heterogeneous
representation of column references for stored tables and for
views.
- Added a new list TABLE_LIST::next_name_resolution_table to
support name resolution with NATURAL/USING joins. Also added
other members to TABLE_LIST to support NATURAL/USING joins.
- Added a generic iterator over the fields of table references
of various types - class Field_iterator_table_ref
tests/mysql_client_test.c:
Adjusted according to standard NATURAL JOIN syntax.
2005-08-12 16:57:19 +02:00
|
|
|
ERROR 42S22: Unknown column 't2.a' in 'field list'
|
2005-06-27 15:46:41 +02:00
|
|
|
insert into t1 select t2.a from t2 group by t2.a on duplicate key update a= t1.a + t2.b;
|
Implementation of WL#2486 -
"Process NATURAL and USING joins according to SQL:2003".
* Some of the main problems fixed by the patch:
- in "select *" queries the * expanded correctly according to
ANSI for arbitrary natural/using joins
- natural/using joins are correctly transformed into JOIN ... ON
for any number/nesting of the joins.
- column references are correctly resolved against natural joins
of any nesting and combined with arbitrary other joins.
* This patch also contains a fix for name resolution of items
inside the ON condition of JOIN ... ON - in this case items must
be resolved only against the JOIN operands. To support such
'local' name resolution, the patch introduces a stack of
name resolution contexts used at parse time.
NOTICE:
- This patch is not complete in the sense that
- there are 2 test cases that still do not pass -
one in join.test, one in select.test. Both are marked
with a comment "TODO: WL#2486".
- it does not include a new test specific for the task
mysql-test/include/ps_query.inc:
Adjusted according to standard NATURAL/USING join semantics.,
mysql-test/r/bdb.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/derived.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/errors.result:
The column as a whole cannot be resolved, so different error message.
mysql-test/r/fulltext.result:
Adjusted according to standard JOIN ... ON semantics =>
the ON condition can refer only to the join operands.
mysql-test/r/fulltext_order_by.result:
More detailed error message.
mysql-test/r/innodb.result:
Adjusted according to standard NATURAL/USING join semantics.
This test doesn't pass completetly yet!
mysql-test/r/insert_select.result:
More detailed error message.
mysql-test/r/join.result:
Adjusted according to standard NATURAL/USING join semantics.
NOTICE: there is one test case that still fails, and it is
commeted out and marked with WL#2486 in the test file.
mysql-test/r/join_crash.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/join_nested.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/join_outer.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/multi_update.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/null_key.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/order_by.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/ps_2myisam.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/ps_3innodb.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/ps_4heap.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/ps_5merge.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/ps_6bdb.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/ps_7ndb.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/select.result:
Adjusted according to standard NATURAL/USING join semantics.
NOTICE: there is one failing test case which is commented with
WL#2486 in the test file.
mysql-test/r/subselect.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/type_ranges.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/union.result:
More detailed error message.
mysql-test/t/bdb.test:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/t/errors.test:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/t/fulltext.test:
Adjusted according to standard JOIN ... ON semantics =>
the ON condition can refer only to the join operands.
mysql-test/t/fulltext_order_by.test:
More detailed error message.
mysql-test/t/innodb.test:
Adjusted according to standard NATURAL/USING join semantics.
This test doesn't pass completetly yet!
mysql-test/t/insert_select.test:
More detailed error message.
mysql-test/t/join.test:
Adjusted according to standard NATURAL/USING join semantics.
NOTICE: there is one test case that still fails, and it is
commeted out and marked with WL#2486 in the test file.
mysql-test/t/join_crash.test:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/t/join_nested.test:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/t/join_outer.test:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/t/null_key.test:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/t/order_by.test:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/t/select.test:
Adjusted according to standard NATURAL/USING join semantics.
NOTICE: there is one test case that still fails, and it is
commeted out and marked with WL#2486 in the test file.
mysql-test/t/subselect.test:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/t/type_ranges.test:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/t/union.test:
More detailed error message.
sql/item.cc:
- extra parameter to find_field_in_tables
- find_field_in_real_table renamed to find_field_in_table
- fixed comments/typos
sql/item.h:
- added [first | last]_name_resolution_table to class
Name_resolution_context
- commented old code
- standardized formatting
sql/mysql_priv.h:
- refactored the find_field_in_XXX procedures,
- added a new procedure for natural join table references,
- renamed the find_field_in_XXX procedures to clearer names
sql/sp.cc:
- pass the top-most list of the FROM clause to setup_tables
- extra parameter to find_field_in_tables
sql/sql_acl.cc:
- renamed find_field_in_table => find_field_in_table_ref
- extra parameter to find_field_in_table_ref
- commented old code
sql/sql_base.cc:
This file contains the core of the implementation of the processing
of NATURAL/USING joins (WL#2486).
- added many comments to old code
- refactored the group of find_field_in_XXX procedures, and added a
new procedure for natural joins. There is one find_field_in_XXX procedure
per each type of table reference (stored table, merge view, or natural
join); one meta-procedure that selects the correct one depeneding on the
table reference; and one procedure that goes over a list of table
referenes.
- NATURAL/USING joins are processed through the procedures:
mark_common_columns, store_natural_using_join_columns,
store_top_level_join_columns, setup_natural_join_row_types.
The entry point to processing NATURAL/USING joins is the
procedure 'setup_natural_join_row_types'.
- Replaced the specialized Field_iterator_XXX iterators with one
generic iterator over the fields of a table reference.
- Simplified 'insert_fields' and 'setup_conds' due to encapsulation of
the processing of natural joins in a separate set of procedures.
sql/sql_class.h:
- Commented old code.
sql/sql_delete.cc:
- Pass the FROM clause to setup_tables.
sql/sql_help.cc:
- pass the end name resolution table to find_field_in_tables
- adjust the list of tables for name resolution
sql/sql_insert.cc:
- Changed the code that saves and restores the current context to
support the list of tables for name resolution -
context->first_name_resolution_table, and
table_list->next_name_resolution_table.
Needed to support an ugly trick to resolve inserted columns only in
the first table.
- Added Name_resolution_context::[first | last]_name_resolution_table.
- Commented old code
sql/sql_lex.cc:
- set select_lex.parent_lex correctly
- set correct state of the current name resolution context
sql/sql_lex.h:
- Added a stack of name resolution contexts to support local
contexts for JOIN ... ON conditions.
- Commented old code.
sql/sql_load.cc:
- Pass the FROM clause to setup_tables.
sql/sql_olap.cc:
- Pass the FROM clause to setup_tables.
sql/sql_parse.cc:
- correctly set SELECT_LEX::parent_lex
- set the first table of the current name resoltion context
- added support for NATURAL/USING joins
- commented old code
sql/sql_select.cc:
- Pass the FROM clause to setup_tables.
- Pass the end table to find_field_in_tables
- Improved comments
sql/sql_show.cc:
- Set SELECT_LEX::parent_lex.
sql/sql_update.cc:
- Pass the FROM clause to setup_tables.
sql/sql_yacc.yy:
- Added support for a stack of name resolution contexts needed to
implement name resolution for JOIN ... ON. A context is pushed
for each new JOIN ... ON, and popped afterwards.
- Added support for NATURAL/USING joins.
sql/table.cc:
- Added new class Natural_join_column to hide the heterogeneous
representation of column references for stored tables and for
views.
- Added a new list TABLE_LIST::next_name_resolution_table to
support name resolution with NATURAL/USING joins. Also added
other members to TABLE_LIST to support NATURAL/USING joins.
- Added a generic iterator over the fields of table references
of various types - class Field_iterator_table_ref
sql/table.h:
- Added new class Natural_join_column to hide the heterogeneous
representation of column references for stored tables and for
views.
- Added a new list TABLE_LIST::next_name_resolution_table to
support name resolution with NATURAL/USING joins. Also added
other members to TABLE_LIST to support NATURAL/USING joins.
- Added a generic iterator over the fields of table references
of various types - class Field_iterator_table_ref
tests/mysql_client_test.c:
Adjusted according to standard NATURAL JOIN syntax.
2005-08-12 16:57:19 +02:00
|
|
|
ERROR 42S22: Unknown column 't2.b' in 'field list'
|
2005-06-27 15:46:41 +02:00
|
|
|
drop table t1,t2,t3;
|
2005-10-28 01:36:19 +02:00
|
|
|
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;
|
2005-10-25 18:04:12 +02:00
|
|
|
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);
|
2005-10-28 01:36:19 +02:00
|
|
|
ERROR 42S22: Unknown column 't2.x' in 'field list'
|
2005-10-25 18:04:12 +02:00
|
|
|
drop table t1,t2;
|
2006-06-19 12:22:42 +02:00
|
|
|
CREATE TABLE t1 (a int PRIMARY KEY);
|
|
|
|
INSERT INTO t1 values (1), (2);
|
2007-06-23 22:20:14 +02:00
|
|
|
flush status;
|
2006-06-19 12:22:42 +02:00
|
|
|
INSERT INTO t1 SELECT a + 2 FROM t1 LIMIT 1;
|
2007-06-23 22:20:14 +02:00
|
|
|
show status like 'Handler_read%';
|
|
|
|
Variable_name Value
|
|
|
|
Handler_read_first 1
|
|
|
|
Handler_read_key 0
|
2010-08-25 21:00:38 +02:00
|
|
|
Handler_read_last 0
|
2007-06-23 22:20:14 +02:00
|
|
|
Handler_read_next 0
|
|
|
|
Handler_read_prev 0
|
2016-08-21 19:18:39 +02:00
|
|
|
Handler_read_retry 0
|
2007-06-23 22:20:14 +02:00
|
|
|
Handler_read_rnd 0
|
2012-01-18 11:53:50 +01:00
|
|
|
Handler_read_rnd_deleted 0
|
2007-06-23 22:20:14 +02:00
|
|
|
Handler_read_rnd_next 1
|
2006-06-19 12:22:42 +02:00
|
|
|
DROP TABLE t1;
|
2007-07-31 08:10:03 +02:00
|
|
|
CREATE TABLE t1 (
|
|
|
|
f1 int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
|
|
|
|
f2 varchar(100) NOT NULL default ''
|
|
|
|
);
|
|
|
|
CREATE TABLE t2 (
|
|
|
|
f1 varchar(10) NOT NULL default '',
|
|
|
|
f2 char(3) NOT NULL default '',
|
|
|
|
PRIMARY KEY (`f1`),
|
|
|
|
KEY `k1` (`f2`, `f1`)
|
|
|
|
);
|
|
|
|
INSERT INTO t1 values(NULL, '');
|
|
|
|
INSERT INTO `t2` VALUES ('486878','WDT'),('486910','WDT');
|
|
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
COUNT(*)
|
|
|
|
1
|
|
|
|
SELECT min(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
|
|
|
|
min(t2.f1)
|
|
|
|
INSERT INTO t1 (f2)
|
|
|
|
SELECT min(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
|
|
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
COUNT(*)
|
|
|
|
1
|
|
|
|
SELECT * FROM t1;
|
|
|
|
f1 f2
|
|
|
|
1
|
|
|
|
DROP TABLE t1, t2;
|
2006-06-19 16:34:12 +02:00
|
|
|
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;
|
2006-09-12 16:50:24 +02:00
|
|
|
CREATE DATABASE bug21774_1;
|
|
|
|
CREATE DATABASE bug21774_2;
|
|
|
|
CREATE TABLE bug21774_1.t1(id VARCHAR(10) NOT NULL,label VARCHAR(255));
|
|
|
|
CREATE TABLE bug21774_2.t1(id VARCHAR(10) NOT NULL,label VARCHAR(255));
|
|
|
|
CREATE TABLE bug21774_1.t2(id VARCHAR(10) NOT NULL,label VARCHAR(255));
|
|
|
|
INSERT INTO bug21774_2.t1 SELECT t1.* FROM bug21774_1.t1;
|
|
|
|
use bug21774_1;
|
|
|
|
INSERT INTO bug21774_2.t1 SELECT t1.* FROM t1;
|
|
|
|
DROP DATABASE bug21774_1;
|
|
|
|
DROP DATABASE bug21774_2;
|
2007-02-06 22:46:03 +01:00
|
|
|
USE test;
|
|
|
|
create table t1(f1 int primary key, f2 int);
|
|
|
|
insert into t1 values (1,1);
|
|
|
|
affected rows: 1
|
|
|
|
insert into t1 values (1,1) on duplicate key update f2=1;
|
|
|
|
affected rows: 0
|
|
|
|
insert into t1 values (1,1) on duplicate key update f2=2;
|
|
|
|
affected rows: 2
|
|
|
|
select * from t1;
|
|
|
|
f1 f2
|
|
|
|
1 2
|
|
|
|
drop table t1;
|
2007-02-16 17:39:28 +01:00
|
|
|
CREATE TABLE t1 (f1 INT, f2 INT );
|
|
|
|
CREATE TABLE t2 (f1 INT PRIMARY KEY, f2 INT);
|
|
|
|
INSERT INTO t1 VALUES (1,1),(2,2),(10,10);
|
|
|
|
INSERT INTO t2 (f1, f2) SELECT f1, f2 FROM t1;
|
|
|
|
INSERT INTO t2 (f1, f2)
|
|
|
|
SELECT f1, f1 FROM t2 src WHERE f1 < 2
|
|
|
|
ON DUPLICATE KEY UPDATE f1 = 100 + src.f1;
|
|
|
|
SELECT * FROM t2;
|
|
|
|
f1 f2
|
2012-02-29 21:55:04 +01:00
|
|
|
10 10
|
2007-02-16 17:39:28 +01:00
|
|
|
101 1
|
|
|
|
2 2
|
|
|
|
DROP TABLE t1, t2;
|
2017-02-08 21:28:00 +01:00
|
|
|
SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
|
2009-05-04 14:45:36 +02:00
|
|
|
CREATE TABLE t1 ( a INT KEY, b INT );
|
|
|
|
INSERT INTO t1 VALUES ( 0, 1 );
|
|
|
|
INSERT INTO t1 ( b ) SELECT MAX( b ) FROM t1 WHERE b = 2;
|
|
|
|
ERROR 23000: Duplicate entry '0' for key 'PRIMARY'
|
|
|
|
DROP TABLE t1;
|
2017-02-08 21:28:00 +01:00
|
|
|
SET sql_mode = DEFAULT;
|
2007-03-22 17:44:16 +01:00
|
|
|
SET SQL_MODE='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
|
|
|
|
CREATE TABLE t1 (c VARCHAR(30), INDEX ix_c (c(10)));
|
|
|
|
CREATE TABLE t2 (d VARCHAR(10));
|
|
|
|
INSERT INTO t1 (c) VALUES ('7_chars'), ('13_characters');
|
|
|
|
EXPLAIN
|
|
|
|
SELECT (SELECT SUM(LENGTH(c)) FROM t1 WHERE c='13_characters') FROM t1;
|
|
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
|
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
|
|
|
2 SUBQUERY t1 ref ix_c ix_c 13 const 1 Using where
|
|
|
|
SELECT (SELECT SUM(LENGTH(c)) FROM t1 WHERE c='13_characters') FROM t1;
|
|
|
|
(SELECT SUM(LENGTH(c)) FROM t1 WHERE c='13_characters')
|
|
|
|
13
|
|
|
|
13
|
|
|
|
INSERT INTO t2 (d)
|
|
|
|
SELECT (SELECT SUM(LENGTH(c)) FROM t1 WHERE c='13_characters') FROM t1;
|
|
|
|
INSERT INTO t2 (d)
|
|
|
|
SELECT (SELECT SUM(LENGTH(c)) FROM t1 WHERE c='7_chars') FROM t1;
|
|
|
|
INSERT INTO t2 (d)
|
|
|
|
SELECT (SELECT SUM(LENGTH(c)) FROM t1 WHERE c IN (SELECT t1.c FROM t1))
|
|
|
|
FROM t1;
|
|
|
|
SELECT * FROM t2;
|
|
|
|
d
|
|
|
|
13
|
|
|
|
13
|
|
|
|
7
|
|
|
|
7
|
|
|
|
20
|
|
|
|
20
|
|
|
|
DROP TABLE t1,t2;
|
2007-06-23 22:20:14 +02:00
|
|
|
CREATE TABLE t1 (
|
|
|
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
prev_id INT,
|
|
|
|
join_id INT DEFAULT 0);
|
|
|
|
INSERT INTO t1 (prev_id) VALUES (NULL), (1), (2);
|
|
|
|
SELECT * FROM t1;
|
|
|
|
id prev_id join_id
|
|
|
|
1 NULL 0
|
|
|
|
2 1 0
|
|
|
|
3 2 0
|
|
|
|
CREATE TABLE t2 (join_id INT);
|
|
|
|
INSERT INTO t2 (join_id) VALUES (0);
|
|
|
|
INSERT INTO t1 (prev_id) SELECT id
|
|
|
|
FROM t2 LEFT JOIN t1 ON t1.join_id = t2.join_id
|
|
|
|
ORDER BY id DESC LIMIT 1;
|
|
|
|
SELECT * FROM t1;
|
|
|
|
id prev_id join_id
|
|
|
|
1 NULL 0
|
|
|
|
2 1 0
|
|
|
|
3 2 0
|
|
|
|
4 3 0
|
|
|
|
DROP TABLE t1,t2;
|
2007-09-21 10:09:00 +02:00
|
|
|
#
|
|
|
|
# Bug#30384: Having SQL_BUFFER_RESULT option in the
|
|
|
|
# CREATE .. KEY(..) .. SELECT led to creating corrupted index.
|
|
|
|
#
|
|
|
|
create table t1(f1 int);
|
|
|
|
insert into t1 values(1),(2),(3);
|
|
|
|
create table t2 (key(f1)) engine=myisam select sql_buffer_result f1 from t1;
|
|
|
|
check table t2 extended;
|
|
|
|
Table Op Msg_type Msg_text
|
|
|
|
test.t2 check status OK
|
|
|
|
drop table t1,t2;
|
2009-07-24 13:50:45 +02:00
|
|
|
End of 5.0 tests
|
2007-09-21 10:09:00 +02:00
|
|
|
##################################################################
|
2009-07-24 13:50:45 +02:00
|
|
|
#
|
|
|
|
# Bug #46075: Assertion failed: 0, file .\protocol.cc, line 416
|
|
|
|
#
|
|
|
|
CREATE TABLE t1(a INT);
|
|
|
|
SET max_heap_table_size = 16384;
|
|
|
|
SET @old_myisam_data_pointer_size = @@myisam_data_pointer_size;
|
|
|
|
SET GLOBAL myisam_data_pointer_size = 2;
|
|
|
|
INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
|
2011-02-16 21:43:12 +01:00
|
|
|
call mtr.add_suppression("mysqld.*: The table '.*#sql.*' is full");
|
2009-07-24 13:50:45 +02:00
|
|
|
INSERT IGNORE INTO t1 SELECT t1.a FROM t1,t1 t2,t1 t3,t1 t4,t1 t5,t1 t6,t1 t7;
|
|
|
|
SET GLOBAL myisam_data_pointer_size = @old_myisam_data_pointer_size;
|
|
|
|
DROP TABLE t1;
|
2009-11-16 21:49:51 +01:00
|
|
|
End of 5.1 tests
|
2018-05-15 17:34:47 +02:00
|
|
|
create table t1 (i int);
|
2018-05-22 11:47:09 +02:00
|
|
|
create table t2 as select value(i) as a from t1;
|
2018-05-15 17:34:47 +02:00
|
|
|
show create table t2;
|
|
|
|
Table Create Table
|
|
|
|
t2 CREATE TABLE `t2` (
|
|
|
|
`a` binary(0) DEFAULT NULL
|
2022-09-02 15:32:14 +02:00
|
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
2018-05-15 17:34:47 +02:00
|
|
|
drop table t1, t2;
|
|
|
|
End of 5.5 tests
|
2021-12-24 09:30:47 +01:00
|
|
|
#
|
|
|
|
# Beginning of 10.2 test
|
|
|
|
#
|
|
|
|
# MDEV-26698: Incorrect row number upon INSERT .. SELECT from the same
|
|
|
|
# table: rows are counted twice
|
|
|
|
#
|
|
|
|
CREATE TABLE t1(a TINYINT);
|
|
|
|
INSERT INTO t1 VALUES (1), (100);
|
|
|
|
INSERT INTO t1 SELECT a*2 FROM t1;
|
|
|
|
Warnings:
|
|
|
|
Warning 1264 Out of range value for column 'a' at row 2
|
|
|
|
TRUNCATE TABLE t1;
|
|
|
|
# using ORDER BY
|
|
|
|
INSERT INTO t1 VALUES(1), (2), (100), (3);
|
|
|
|
INSERT INTO t1 SELECT a*2 FROM t1 ORDER BY a;
|
|
|
|
Warnings:
|
|
|
|
Warning 1264 Out of range value for column 'a' at row 4
|
|
|
|
DROP TABLE t1;
|
2022-06-18 15:54:39 +02:00
|
|
|
CREATE TABLE t1 (a INT, b INT);
|
|
|
|
INSERT INTO t1 (a) SELECT SUM(1);
|
|
|
|
INSERT INTO t1 (a, b) SELECT AVG(2), MIN(3);
|
|
|
|
INSERT INTO t1 (b) SELECT AVG('x') OVER ();
|
|
|
|
ERROR 22007: Truncated incorrect DOUBLE value: 'x'
|
|
|
|
INSERT INTO t1 SELECT MIN(7) OVER (), MAX(8) OVER();
|
|
|
|
SELECT * FROM t1;
|
|
|
|
a b
|
|
|
|
1 NULL
|
|
|
|
2 3
|
|
|
|
7 8
|
|
|
|
PREPARE stmt FROM 'INSERT INTO t1 (a) SELECT AVG(?)';
|
|
|
|
EXECUTE stmt USING 9;
|
|
|
|
EXECUTE stmt USING 10;
|
|
|
|
PREPARE stmt FROM 'INSERT INTO t1 SELECT MIN(?), MAX(?)';
|
|
|
|
EXECUTE stmt USING 11, 12;
|
|
|
|
EXECUTE stmt USING 13, 14;
|
|
|
|
DEALLOCATE PREPARE stmt;
|
|
|
|
SELECT * FROM t1;
|
|
|
|
a b
|
|
|
|
1 NULL
|
|
|
|
2 3
|
|
|
|
7 8
|
|
|
|
9 NULL
|
|
|
|
10 NULL
|
|
|
|
11 12
|
|
|
|
13 14
|
|
|
|
CREATE PROCEDURE p1(param_a INT, param_b INT)
|
|
|
|
BEGIN
|
|
|
|
INSERT INTO t1 SELECT MIN(param_a) OVER (), MAX(param_b);
|
|
|
|
END//
|
|
|
|
CALL p1(21, 22);
|
|
|
|
CALL p1(23, 24);
|
|
|
|
SELECT * FROM t1;
|
|
|
|
a b
|
|
|
|
1 NULL
|
|
|
|
2 3
|
|
|
|
7 8
|
|
|
|
9 NULL
|
|
|
|
10 NULL
|
|
|
|
11 12
|
|
|
|
13 14
|
|
|
|
21 22
|
|
|
|
23 24
|
|
|
|
CREATE TABLE t2 (
|
|
|
|
a DECIMAL UNIQUE CHECK (CASE 0 * 27302337.000000 WHEN 34 THEN
|
|
|
|
+ 'x' LIKE 'x' OR a NOT IN (-1 / TRUE ^ 2) ELSE 7105743.000000 END));
|
|
|
|
INSERT INTO t2 VALUES (90),( -1),(31152443.000000),(-32768),(NULL),(NULL);
|
|
|
|
INSERT INTO t2 SELECT AVG('x') OVER (
|
|
|
|
PARTITION BY ((NOT AVG(76698761.000000))) IS NOT NULL);
|
|
|
|
ERROR 22007: Truncated incorrect DOUBLE value: 'x'
|
|
|
|
INSERT IGNORE INTO t2 () VALUES (0),('x'),(3751286.000000),
|
|
|
|
('x'),((a = 'x' AND 0 AND 0));
|
|
|
|
Warnings:
|
|
|
|
Warning 1366 Incorrect decimal value: 'x' for column `test`.`t2`.`a` at row 2
|
|
|
|
Warning 1062 Duplicate entry '0' for key 'a'
|
|
|
|
Warning 1366 Incorrect decimal value: 'x' for column `test`.`t2`.`a` at row 4
|
|
|
|
Warning 1062 Duplicate entry '0' for key 'a'
|
|
|
|
Warning 1062 Duplicate entry '0' for key 'a'
|
|
|
|
INSERT INTO t2 VALUES (127);
|
|
|
|
INSERT INTO t2 SELECT -2147483648 END FROM t2 AS TEXT JOIN t2 JOIN t2 TABLES;
|
|
|
|
ERROR 23000: Duplicate entry '-2147483648' for key 'a'
|
|
|
|
ALTER TABLE t2 ADD (
|
|
|
|
b INT UNIQUE CHECK ((a = 'x' AND ((-(+(BINARY 49730460.000000)))) = 'x'
|
|
|
|
BETWEEN 'x' AND 'x')));
|
|
|
|
ERROR 22007: Truncated incorrect DECIMAL value: 'x'
|
|
|
|
UPDATE t2 SET a = -128 WHERE a IS NULL ORDER BY 78 IN ('x','x'),a;
|
|
|
|
ERROR 23000: Duplicate entry '-128' for key 'a'
|
|
|
|
DROP TABLE t1, t2;
|
|
|
|
DROP PROCEDURE p1;
|
2021-12-24 09:30:47 +01:00
|
|
|
# End of 10.2 test
|
2022-08-02 05:52:10 +02:00
|
|
|
#
|
|
|
|
# MDEV-28617: INSERT ... SELECT with redundant IN subquery in GROUP BY
|
|
|
|
# list that uses mergeable derived table containing
|
|
|
|
# reference to target table
|
|
|
|
#
|
|
|
|
create table t1 (a int);
|
|
|
|
create table t2 (b int);
|
|
|
|
create table t3 (c int);
|
|
|
|
insert into t1 values (3), (1);
|
|
|
|
insert into t2 values (3), (2);
|
|
|
|
insert into t3 values (4), (2);
|
|
|
|
insert into t1
|
|
|
|
select b from t2
|
|
|
|
where b in (select c from t3
|
|
|
|
group by (select * from (select a from t1) dt where a = 1));
|
|
|
|
select * from t1;
|
|
|
|
a
|
|
|
|
3
|
|
|
|
1
|
|
|
|
delete from t1;
|
|
|
|
insert into t1 values (3), (1);
|
|
|
|
insert into t1
|
|
|
|
select b from t2
|
|
|
|
where b >= any (select c from t3
|
|
|
|
group by (select * from (select a from t1) dt where a = 1));
|
|
|
|
select * from t1;
|
|
|
|
a
|
|
|
|
3
|
|
|
|
1
|
|
|
|
delete from t1;
|
|
|
|
insert into t1 values (3), (1);
|
|
|
|
insert into t1
|
|
|
|
select b from t2
|
|
|
|
where b <= all (select c from t3
|
|
|
|
group by (select * from (select a from t1) dt where a = 1));
|
|
|
|
select * from t1;
|
|
|
|
a
|
|
|
|
3
|
|
|
|
1
|
2024-05-07 13:10:35 +02:00
|
|
|
3
|
2022-08-02 05:52:10 +02:00
|
|
|
2
|
|
|
|
delete from t1;
|
|
|
|
insert into t1 values (3), (1);
|
|
|
|
insert into t1
|
|
|
|
select b from t2
|
|
|
|
where exists (select c from t3
|
|
|
|
group by (select * from (select a from t1) dt where a = 1));
|
|
|
|
select * from t1;
|
|
|
|
a
|
|
|
|
3
|
|
|
|
1
|
|
|
|
3
|
|
|
|
2
|
|
|
|
delete from t1;
|
|
|
|
insert into t1 values (3), (1);
|
|
|
|
prepare stmt from "
|
|
|
|
insert into t1
|
|
|
|
select b from t2
|
|
|
|
where b in (select c from t3
|
|
|
|
group by (select * from (select a from t1) dt where a = 1));
|
|
|
|
";
|
|
|
|
execute stmt;
|
|
|
|
select * from t1;
|
|
|
|
a
|
|
|
|
3
|
|
|
|
1
|
|
|
|
delete from t1;
|
|
|
|
insert into t1 values (3), (1);
|
|
|
|
execute stmt;
|
|
|
|
select * from t1;
|
|
|
|
a
|
|
|
|
3
|
|
|
|
1
|
|
|
|
delete from t1;
|
|
|
|
insert into t1 values (3), (1);
|
|
|
|
delete from t1
|
|
|
|
where exists (select b from t2
|
|
|
|
where b in (select c from t3
|
|
|
|
group by (select * from (select a from t1) dt
|
|
|
|
where a = 1)));
|
|
|
|
select * from t1;
|
|
|
|
a
|
2024-05-07 13:10:35 +02:00
|
|
|
3
|
|
|
|
1
|
2022-08-02 05:52:10 +02:00
|
|
|
deallocate prepare stmt;
|
|
|
|
drop table t1,t2,t3;
|
2023-01-07 23:53:09 +01:00
|
|
|
#
|
|
|
|
# MDEV-30342 Wrong "Truncated incorrect DECIMAL value" warning/error
|
|
|
|
#
|
|
|
|
create table t1(c1 varchar(1));
|
|
|
|
create table t2(c1 varchar(1));
|
|
|
|
insert into t1(c1) values('#');
|
|
|
|
select @@sql_mode like '%strict_all_tables%';
|
|
|
|
@@sql_mode like '%strict_all_tables%'
|
|
|
|
0
|
|
|
|
insert into t2(c1) select if(c1 = '#', c1 = 0, c1) as c1 from t1;
|
|
|
|
drop table t1, t2;
|
|
|
|
#
|
2022-08-02 05:52:10 +02:00
|
|
|
# End of 10.3 test
|
2023-01-07 23:53:09 +01:00
|
|
|
#
|