Automatic merge
This commit is contained in:
commit
620d14f8c3
@ -21,6 +21,12 @@ extra_configs="$extra_configs $local_infile_configs $EXTRA_CONFIGS"
|
||||
|
||||
configure="./configure $base_configs $extra_configs"
|
||||
|
||||
if test "$just_print" = "1" -a "$just_configure" = "1"
|
||||
then
|
||||
just_print=""
|
||||
configure="$configure --print"
|
||||
fi
|
||||
|
||||
commands="\
|
||||
/bin/rm -rf configure;
|
||||
/bin/rm -rf CMakeCache.txt CMakeFiles/
|
||||
|
@ -897,6 +897,7 @@ static COMMANDS commands[] = {
|
||||
{ "LAST_INSERT_ID", 0, 0, 0, ""},
|
||||
{ "ISSIMPLE", 0, 0, 0, ""},
|
||||
{ "LAST_DAY", 0, 0, 0, ""},
|
||||
{ "LAST_VALUE", 0, 0, 0, ""},
|
||||
{ "LCASE", 0, 0, 0, ""},
|
||||
{ "LEAST", 0, 0, 0, ""},
|
||||
{ "LENGTH", 0, 0, 0, ""},
|
||||
|
@ -25,6 +25,7 @@ my $cmakeargs = "";
|
||||
# Assume this script is in <srcroot>/cmake
|
||||
my $srcdir = dirname(dirname(abs_path($0)));
|
||||
my $cmake_install_prefix="";
|
||||
my $just_print= 0;
|
||||
|
||||
# Sets installation directory, bindir, libdir, libexecdir etc
|
||||
# the equivalent CMake variables are given without prefix
|
||||
@ -113,6 +114,11 @@ foreach my $option (@ARGV)
|
||||
system("cmake ${srcdir} -LH");
|
||||
exit(0);
|
||||
}
|
||||
if ($option =~ /print/)
|
||||
{
|
||||
$just_print=1;
|
||||
next;
|
||||
}
|
||||
if($option =~ /with-plugins=/)
|
||||
{
|
||||
my @plugins= split(/,/, substr($option,13));
|
||||
@ -223,6 +229,7 @@ foreach my $option (@ARGV)
|
||||
}
|
||||
|
||||
print("configure.pl : calling cmake $srcdir $cmakeargs\n");
|
||||
exit(0) if ($just_print);
|
||||
unlink("CMakeCache.txt");
|
||||
my $rc = system("cmake $srcdir $cmakeargs");
|
||||
exit($rc);
|
||||
|
@ -51,6 +51,7 @@ SET(HEADERS
|
||||
m_ctype.h
|
||||
my_attribute.h
|
||||
my_compiler.h
|
||||
handler_state.h
|
||||
)
|
||||
|
||||
INSTALL(FILES ${HEADERS} DESTINATION ${INSTALL_INCLUDEDIR} COMPONENT Development)
|
||||
|
21
include/handler_state.h
Normal file
21
include/handler_state.h
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
Map handler error message to sql states. Note that this list MUST be in
|
||||
increasing order!
|
||||
See sql_state.c for usage
|
||||
*/
|
||||
|
||||
{ HA_ERR_KEY_NOT_FOUND, "02000", "" },
|
||||
{ HA_ERR_FOUND_DUPP_KEY, "23000", "" },
|
||||
{ HA_ERR_WRONG_COMMAND, "0A000", "" },
|
||||
{ HA_ERR_UNSUPPORTED, "0A000", "" },
|
||||
{ HA_WRONG_CREATE_OPTION, "0A000", "" },
|
||||
{ HA_ERR_FOUND_DUPP_UNIQUE, "23000", "" },
|
||||
{ HA_ERR_UNKNOWN_CHARSET, "0A000", "" },
|
||||
{ HA_ERR_READ_ONLY_TRANSACTION, "25000", "" },
|
||||
{ HA_ERR_LOCK_DEADLOCK, "40001", "" },
|
||||
{ HA_ERR_NO_REFERENCED_ROW, "23000", "" },
|
||||
{ HA_ERR_ROW_IS_REFERENCED, "23000", "" },
|
||||
{ HA_ERR_TABLE_EXIST, "42S01", "" },
|
||||
{ HA_ERR_FOREIGN_DUPLICATE_KEY, "23000", "" },
|
||||
{ HA_ERR_TABLE_READONLY, "25000", "" },
|
||||
{ HA_ERR_AUTOINC_ERANGE, "22003", "" },
|
@ -95,7 +95,7 @@ nolock_wrap(lf_dynarray_iterate, int,
|
||||
*/
|
||||
|
||||
#define LF_PINBOX_PINS 4
|
||||
#define LF_PURGATORY_SIZE 10
|
||||
#define LF_PURGATORY_SIZE 100
|
||||
|
||||
typedef void lf_pinbox_free_func(void *, void *, void*);
|
||||
|
||||
|
@ -85,6 +85,7 @@ typedef struct my_aio_result {
|
||||
#define MY_THREADSAFE 2048 /* my_seek(): lock fd mutex */
|
||||
#define MY_SYNC 4096 /* my_copy(): sync dst file */
|
||||
#define MY_SYNC_DIR 32768 /* my_create/delete/rename: sync directory */
|
||||
#define MY_SYNC_FILESIZE 65536 /* my_sync(): safe sync when file is extended */
|
||||
|
||||
#define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */
|
||||
#define MY_GIVE_INFO 2 /* Give time info about process*/
|
||||
|
@ -205,16 +205,55 @@ DROP PROCEDURE p4;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
# Test of a too big SET INSERT_ID: see if the truncated value goes
|
||||
# into binlog (right), or the too big value (wrong); we look at the
|
||||
# binlog further down with SHOW BINLOG EVENTS.
|
||||
# Test of a too big SET INSERT_ID.
|
||||
# This should generate an error and should not be put in binlog
|
||||
# We look at the binlog further down with SHOW BINLOG EVENTS.
|
||||
|
||||
reset master;
|
||||
create table t1 (id tinyint auto_increment primary key);
|
||||
insert into t1 values(5);
|
||||
set insert_id=128;
|
||||
insert into t1 values(null);
|
||||
--error 167
|
||||
insert into t1 values(null) /* Not binlogged */;
|
||||
|
||||
# The followin insert ignore will be put in binlog
|
||||
set insert_id=128;
|
||||
insert ignore into t1 values(null) /* Insert 128 */;
|
||||
|
||||
# Insert with duplicate key error should not go into binglo
|
||||
set insert_id=5;
|
||||
--error ER_DUP_ENTRY
|
||||
insert into t1 values(null) /* Not binlogged */;
|
||||
|
||||
# Insert with autogenerated key + duplicate key error should go into binlog
|
||||
set insert_id=5;
|
||||
insert ignore into t1 values(null) /* Insert 5 */;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
# Same tests but with 2 rows inserted at a time
|
||||
|
||||
create table t1 (id tinyint auto_increment primary key) engine=myisam;
|
||||
set insert_id=128;
|
||||
--error 167
|
||||
insert into t1 values(5),(null) /* Insert_id 128 */;
|
||||
|
||||
# The followin insert ignore will be put in binlog
|
||||
set insert_id=128;
|
||||
insert ignore into t1 values (4),(null) /* Insert_id 128 */;
|
||||
|
||||
# Insert with duplicate key error should not go into binglo
|
||||
set insert_id=5;
|
||||
--error ER_DUP_ENTRY
|
||||
insert into t1 values(3),(null) /* Insert_id 5 */;
|
||||
|
||||
# Insert with autogenerated key + duplicate key error should go into binlog
|
||||
set insert_id=5;
|
||||
insert ignore into t1 values(2),(null) /* Insert_id 5 */;
|
||||
select * from t1 order by id;
|
||||
drop table t1;
|
||||
|
||||
|
||||
# bug#22027
|
||||
create table t1 (a int);
|
||||
create table if not exists t2 select * from t1;
|
||||
|
@ -28,6 +28,7 @@
|
||||
# BUG#20627: INSERT DELAYED does not honour auto_increment_* variables
|
||||
# Bug in this test: BUG#38068: binlog_stm_binlog fails sporadically in pushbuild
|
||||
|
||||
reset master;
|
||||
|
||||
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
|
||||
|
||||
|
@ -111,7 +111,7 @@ set auto_increment_increment=11;
|
||||
set auto_increment_offset=4;
|
||||
insert into t1 values(null);
|
||||
insert into t1 values(null);
|
||||
--error ER_DUP_ENTRY
|
||||
--error 167
|
||||
insert into t1 values(null);
|
||||
select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t1 order by a;
|
||||
|
||||
@ -120,6 +120,8 @@ create table t2 (a tinyint unsigned not null auto_increment primary key) engine=
|
||||
set auto_increment_increment=10;
|
||||
set auto_increment_offset=1;
|
||||
set insert_id=1000;
|
||||
insert into t2 values(10);
|
||||
--error 167
|
||||
insert into t2 values(null);
|
||||
select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t2 order by a;
|
||||
|
||||
@ -127,6 +129,7 @@ select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t2 orde
|
||||
create table t3 like t1;
|
||||
set auto_increment_increment=1000;
|
||||
set auto_increment_offset=700;
|
||||
--error 167
|
||||
insert into t3 values(null);
|
||||
select * from t3 order by a;
|
||||
sync_slave_with_master;
|
||||
|
@ -102,7 +102,9 @@ CREATE TABLE t1(a int, UNIQUE(a));
|
||||
--let $_start= query_get_value(SHOW MASTER STATUS, Position, 1)
|
||||
|
||||
INSERT DELAYED IGNORE INTO t1 VALUES(1);
|
||||
--disable_warnings
|
||||
INSERT DELAYED IGNORE INTO t1 VALUES(1);
|
||||
--enable_warnings
|
||||
flush table t1; # to wait for INSERT DELAYED to be done
|
||||
if (`SELECT @@global.binlog_format = 'STATEMENT'`)
|
||||
{
|
||||
|
@ -343,6 +343,7 @@ alter table t1 add index i3(key3);
|
||||
update t1 set key2=key1,key3=key1;
|
||||
|
||||
# to test the bug, the following must use "sort_union":
|
||||
--replace_column 9 REF
|
||||
explain select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40);
|
||||
select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40);
|
||||
drop table t1;
|
||||
|
@ -19,11 +19,12 @@ select count(*) from t1;
|
||||
|
||||
set auto_increment_increment=1000;
|
||||
set auto_increment_offset=700;
|
||||
--error ER_WARN_DATA_OUT_OF_RANGE
|
||||
--error 167
|
||||
insert into t1 values(null);
|
||||
select count(*) from t1;
|
||||
|
||||
set @@sql_mode=@org_mode;
|
||||
--error 167
|
||||
insert into t1 values(null);
|
||||
select * from t1;
|
||||
|
||||
|
10
mysql-test/r/adddate_454.result
Normal file
10
mysql-test/r/adddate_454.result
Normal file
@ -0,0 +1,10 @@
|
||||
create table t1 (d date);
|
||||
insert into t1 values ('2012-00-00');
|
||||
select * from t1;
|
||||
d
|
||||
2012-00-00
|
||||
update t1 set d = adddate(d, interval 1 day);
|
||||
select * from t1;
|
||||
d
|
||||
NULL
|
||||
drop table t1;
|
@ -150,7 +150,7 @@ select last_insert_id();
|
||||
last_insert_id()
|
||||
255
|
||||
insert into t1 set i = null;
|
||||
ERROR 23000: Duplicate entry '255' for key 'PRIMARY'
|
||||
ERROR 22003: Out of range value for column 'i' at row 1
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
255
|
||||
@ -162,8 +162,7 @@ select last_insert_id();
|
||||
last_insert_id()
|
||||
255
|
||||
insert into t1 set i = null;
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'i' at row 1
|
||||
ERROR 22003: Out of range value for column 'i' at row 1
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
255
|
||||
@ -487,7 +486,7 @@ SELECT @@SESSION.AUTO_INCREMENT_OFFSET;
|
||||
@@SESSION.AUTO_INCREMENT_OFFSET
|
||||
1
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
ERROR 22003: Out of range value for column 't1' at row 167
|
||||
ERROR 22003: Out of range value for column 'c1' at row 2
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1
|
||||
|
266
mysql-test/r/auto_increment_ranges_innodb.result
Normal file
266
mysql-test/r/auto_increment_ranges_innodb.result
Normal file
@ -0,0 +1,266 @@
|
||||
set default_storage_engine=innodb;
|
||||
drop table if exists t1;
|
||||
#
|
||||
# Testing ranges with smallint
|
||||
#
|
||||
create table t1 (a smallint primary key auto_increment);
|
||||
insert into t1 values(32767);
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
truncate table t1;
|
||||
insert into t1 values(32767-1);
|
||||
insert into t1 values(NULL);
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
select * from t1;
|
||||
a
|
||||
32766
|
||||
32767
|
||||
truncate table t1;
|
||||
insert into t1 values(32767),(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 2
|
||||
select * from t1;
|
||||
a
|
||||
truncate table t1;
|
||||
insert into t1 values(32767-1),(NULL),(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 3
|
||||
truncate table t1;
|
||||
insert into t1 values(32767+1);
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'a' at row 1
|
||||
select * from t1;
|
||||
a
|
||||
32767
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
drop table t1;
|
||||
#
|
||||
# Testing ranges with unsigned smallint
|
||||
#
|
||||
create table t1 (a smallint unsigned primary key auto_increment);
|
||||
insert into t1 values(65535);
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
truncate table t1;
|
||||
insert into t1 values(65535-1);
|
||||
insert into t1 values(NULL);
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
select * from t1;
|
||||
a
|
||||
65534
|
||||
65535
|
||||
truncate table t1;
|
||||
insert into t1 values(65535),(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 2
|
||||
select * from t1;
|
||||
a
|
||||
truncate table t1;
|
||||
insert into t1 values(65535-1),(NULL),(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 3
|
||||
truncate table t1;
|
||||
insert into t1 values(65535+1);
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'a' at row 1
|
||||
select * from t1;
|
||||
a
|
||||
65535
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
drop table t1;
|
||||
#
|
||||
# Testing ranges with integer
|
||||
#
|
||||
create table t1 (a int primary key auto_increment);
|
||||
insert into t1 values(2147483647);
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
truncate table t1;
|
||||
insert into t1 values(2147483647-1);
|
||||
insert into t1 values(NULL);
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
select * from t1;
|
||||
a
|
||||
2147483646
|
||||
2147483647
|
||||
truncate table t1;
|
||||
insert into t1 values(2147483647),(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 2
|
||||
select * from t1;
|
||||
a
|
||||
truncate table t1;
|
||||
insert into t1 values(2147483647-1),(NULL),(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 3
|
||||
truncate table t1;
|
||||
insert into t1 values(2147483647+1);
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'a' at row 1
|
||||
select * from t1;
|
||||
a
|
||||
2147483647
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
drop table t1;
|
||||
#
|
||||
# Testing ranges with unsigned integer
|
||||
#
|
||||
create table t1 (a int unsigned primary key auto_increment);
|
||||
insert into t1 values(4294967295);
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
truncate table t1;
|
||||
insert into t1 values(4294967295-1);
|
||||
insert into t1 values(NULL);
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
select * from t1;
|
||||
a
|
||||
4294967294
|
||||
4294967295
|
||||
truncate table t1;
|
||||
insert into t1 values(4294967295),(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 2
|
||||
select * from t1;
|
||||
a
|
||||
truncate table t1;
|
||||
insert into t1 values(4294967295-1),(NULL),(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 3
|
||||
truncate table t1;
|
||||
insert into t1 values(4294967295+1);
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'a' at row 1
|
||||
select * from t1;
|
||||
a
|
||||
4294967295
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
drop table t1;
|
||||
#
|
||||
# Testing ranges with bigint
|
||||
#
|
||||
create table t1 (a bigint primary key auto_increment);
|
||||
insert into t1 values(cast(9223372036854775807 as unsigned));
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
truncate table t1;
|
||||
insert into t1 values(cast(9223372036854775807 as unsigned)-1);
|
||||
insert into t1 values(NULL);
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
select * from t1;
|
||||
a
|
||||
9223372036854775806
|
||||
9223372036854775807
|
||||
truncate table t1;
|
||||
insert into t1 values(cast(9223372036854775807 as unsigned)),(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 2
|
||||
select * from t1;
|
||||
a
|
||||
truncate table t1;
|
||||
insert into t1 values(cast(9223372036854775807 as unsigned)-1),(NULL),(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 3
|
||||
truncate table t1;
|
||||
insert into t1 values(cast(9223372036854775807 as unsigned)+1);
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'a' at row 1
|
||||
select * from t1;
|
||||
a
|
||||
9223372036854775807
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
drop table t1;
|
||||
#
|
||||
# Testing ranges with unsigned bigint
|
||||
#
|
||||
create table t1 (a bigint unsigned primary key auto_increment);
|
||||
insert into t1 values(18446744073709551615-1);
|
||||
insert into t1 values(NULL);
|
||||
ERROR HY000: Failed to read auto-increment value from storage engine
|
||||
insert into t1 values(NULL);
|
||||
ERROR HY000: Failed to read auto-increment value from storage engine
|
||||
truncate table t1;
|
||||
insert into t1 values(18446744073709551615-1);
|
||||
insert into t1 values(NULL);
|
||||
ERROR HY000: Failed to read auto-increment value from storage engine
|
||||
insert into t1 values(NULL);
|
||||
ERROR HY000: Failed to read auto-increment value from storage engine
|
||||
select * from t1;
|
||||
a
|
||||
18446744073709551614
|
||||
truncate table t1;
|
||||
insert into t1 values(18446744073709551615),(NULL);
|
||||
ERROR HY000: Failed to read auto-increment value from storage engine
|
||||
select * from t1;
|
||||
a
|
||||
truncate table t1;
|
||||
insert into t1 values(18446744073709551615-1),(NULL),(NULL);
|
||||
ERROR HY000: Failed to read auto-increment value from storage engine
|
||||
drop table t1;
|
||||
#
|
||||
# Test IGNORE and strict mode
|
||||
#
|
||||
create table t1 (a smallint primary key auto_increment);
|
||||
insert ignore into t1 values(32766),(NULL),(NULL),(1);
|
||||
Warnings:
|
||||
Warning 167 Out of range value for column 'a' at row 3
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
32766
|
||||
32767
|
||||
truncate table t1;
|
||||
set @org_mode=@@sql_mode;
|
||||
set @@sql_mode='ansi,traditional';
|
||||
insert ignore into t1 values(32766),(NULL),(NULL);
|
||||
Warnings:
|
||||
Warning 167 Out of range value for column 'a' at row 3
|
||||
truncate table t1;
|
||||
insert into t1 values(32766),(NULL),(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 3
|
||||
set @@sql_mode=@org_mode;
|
||||
drop table t1;
|
||||
#
|
||||
# Test auto increment with negative numbers
|
||||
#
|
||||
CREATE TABLE t1 (a INTEGER AUTO_INCREMENT, PRIMARY KEY (a));
|
||||
INSERT INTO t1 VALUES (NULL), (2), (-5), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
-5
|
||||
1
|
||||
2
|
||||
3
|
||||
5
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (-5), (NULL);
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
-5
|
||||
1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Test inserting a value out-of-range into an auto increment column
|
||||
#
|
||||
CREATE TABLE t1 (a smallint AUTO_INCREMENT, PRIMARY KEY (a));
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t1 VALUES (32768);
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'a' at row 1
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
2
|
||||
32767
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Test old behaviour
|
||||
#
|
||||
create table t1 (a smallint primary key auto_increment);
|
||||
insert into t1 values(32766),(NULL);
|
||||
delete from t1 where a=32767;
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
drop table t1;
|
272
mysql-test/r/auto_increment_ranges_myisam.result
Normal file
272
mysql-test/r/auto_increment_ranges_myisam.result
Normal file
@ -0,0 +1,272 @@
|
||||
set default_storage_engine=MYISAM;
|
||||
drop table if exists t1;
|
||||
#
|
||||
# Testing ranges with smallint
|
||||
#
|
||||
create table t1 (a smallint primary key auto_increment);
|
||||
insert into t1 values(32767);
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
truncate table t1;
|
||||
insert into t1 values(32767-1);
|
||||
insert into t1 values(NULL);
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
select * from t1;
|
||||
a
|
||||
32766
|
||||
32767
|
||||
truncate table t1;
|
||||
insert into t1 values(32767),(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 2
|
||||
select * from t1;
|
||||
a
|
||||
32767
|
||||
truncate table t1;
|
||||
insert into t1 values(32767-1),(NULL),(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 3
|
||||
truncate table t1;
|
||||
insert into t1 values(32767+1);
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'a' at row 1
|
||||
select * from t1;
|
||||
a
|
||||
32767
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
drop table t1;
|
||||
#
|
||||
# Testing ranges with unsigned smallint
|
||||
#
|
||||
create table t1 (a smallint unsigned primary key auto_increment);
|
||||
insert into t1 values(65535);
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
truncate table t1;
|
||||
insert into t1 values(65535-1);
|
||||
insert into t1 values(NULL);
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
select * from t1;
|
||||
a
|
||||
65534
|
||||
65535
|
||||
truncate table t1;
|
||||
insert into t1 values(65535),(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 2
|
||||
select * from t1;
|
||||
a
|
||||
65535
|
||||
truncate table t1;
|
||||
insert into t1 values(65535-1),(NULL),(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 3
|
||||
truncate table t1;
|
||||
insert into t1 values(65535+1);
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'a' at row 1
|
||||
select * from t1;
|
||||
a
|
||||
65535
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
drop table t1;
|
||||
#
|
||||
# Testing ranges with integer
|
||||
#
|
||||
create table t1 (a int primary key auto_increment);
|
||||
insert into t1 values(2147483647);
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
truncate table t1;
|
||||
insert into t1 values(2147483647-1);
|
||||
insert into t1 values(NULL);
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
select * from t1;
|
||||
a
|
||||
2147483646
|
||||
2147483647
|
||||
truncate table t1;
|
||||
insert into t1 values(2147483647),(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 2
|
||||
select * from t1;
|
||||
a
|
||||
2147483647
|
||||
truncate table t1;
|
||||
insert into t1 values(2147483647-1),(NULL),(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 3
|
||||
truncate table t1;
|
||||
insert into t1 values(2147483647+1);
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'a' at row 1
|
||||
select * from t1;
|
||||
a
|
||||
2147483647
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
drop table t1;
|
||||
#
|
||||
# Testing ranges with unsigned integer
|
||||
#
|
||||
create table t1 (a int unsigned primary key auto_increment);
|
||||
insert into t1 values(4294967295);
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
truncate table t1;
|
||||
insert into t1 values(4294967295-1);
|
||||
insert into t1 values(NULL);
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
select * from t1;
|
||||
a
|
||||
4294967294
|
||||
4294967295
|
||||
truncate table t1;
|
||||
insert into t1 values(4294967295),(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 2
|
||||
select * from t1;
|
||||
a
|
||||
4294967295
|
||||
truncate table t1;
|
||||
insert into t1 values(4294967295-1),(NULL),(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 3
|
||||
truncate table t1;
|
||||
insert into t1 values(4294967295+1);
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'a' at row 1
|
||||
select * from t1;
|
||||
a
|
||||
4294967295
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
drop table t1;
|
||||
#
|
||||
# Testing ranges with bigint
|
||||
#
|
||||
create table t1 (a bigint primary key auto_increment);
|
||||
insert into t1 values(cast(9223372036854775807 as unsigned));
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
truncate table t1;
|
||||
insert into t1 values(cast(9223372036854775807 as unsigned)-1);
|
||||
insert into t1 values(NULL);
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
select * from t1;
|
||||
a
|
||||
9223372036854775806
|
||||
9223372036854775807
|
||||
truncate table t1;
|
||||
insert into t1 values(cast(9223372036854775807 as unsigned)),(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 2
|
||||
select * from t1;
|
||||
a
|
||||
9223372036854775807
|
||||
truncate table t1;
|
||||
insert into t1 values(cast(9223372036854775807 as unsigned)-1),(NULL),(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 3
|
||||
truncate table t1;
|
||||
insert into t1 values(cast(9223372036854775807 as unsigned)+1);
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'a' at row 1
|
||||
select * from t1;
|
||||
a
|
||||
9223372036854775807
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
drop table t1;
|
||||
#
|
||||
# Testing ranges with unsigned bigint
|
||||
#
|
||||
create table t1 (a bigint unsigned primary key auto_increment);
|
||||
insert into t1 values(18446744073709551615-1);
|
||||
insert into t1 values(NULL);
|
||||
ERROR HY000: Failed to read auto-increment value from storage engine
|
||||
insert into t1 values(NULL);
|
||||
ERROR HY000: Failed to read auto-increment value from storage engine
|
||||
truncate table t1;
|
||||
insert into t1 values(18446744073709551615-1);
|
||||
insert into t1 values(NULL);
|
||||
ERROR HY000: Failed to read auto-increment value from storage engine
|
||||
insert into t1 values(NULL);
|
||||
ERROR HY000: Failed to read auto-increment value from storage engine
|
||||
select * from t1;
|
||||
a
|
||||
18446744073709551614
|
||||
truncate table t1;
|
||||
insert into t1 values(18446744073709551615),(NULL);
|
||||
ERROR HY000: Failed to read auto-increment value from storage engine
|
||||
select * from t1;
|
||||
a
|
||||
18446744073709551615
|
||||
truncate table t1;
|
||||
insert into t1 values(18446744073709551615-1),(NULL),(NULL);
|
||||
ERROR HY000: Failed to read auto-increment value from storage engine
|
||||
drop table t1;
|
||||
#
|
||||
# Test IGNORE and strict mode
|
||||
#
|
||||
create table t1 (a smallint primary key auto_increment);
|
||||
insert ignore into t1 values(32766),(NULL),(NULL),(1);
|
||||
Warnings:
|
||||
Warning 167 Out of range value for column 'a' at row 3
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
32766
|
||||
32767
|
||||
truncate table t1;
|
||||
set @org_mode=@@sql_mode;
|
||||
set @@sql_mode='ansi,traditional';
|
||||
insert ignore into t1 values(32766),(NULL),(NULL);
|
||||
Warnings:
|
||||
Warning 167 Out of range value for column 'a' at row 3
|
||||
truncate table t1;
|
||||
insert into t1 values(32766),(NULL),(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 3
|
||||
set @@sql_mode=@org_mode;
|
||||
drop table t1;
|
||||
#
|
||||
# Test auto increment with negative numbers
|
||||
#
|
||||
CREATE TABLE t1 (a INTEGER AUTO_INCREMENT, PRIMARY KEY (a));
|
||||
INSERT INTO t1 VALUES (NULL), (2), (-5), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
-5
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (-5), (NULL);
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
-5
|
||||
1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Test inserting a value out-of-range into an auto increment column
|
||||
#
|
||||
CREATE TABLE t1 (a smallint AUTO_INCREMENT, PRIMARY KEY (a));
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t1 VALUES (32768);
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'a' at row 1
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
2
|
||||
32767
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Test old behaviour
|
||||
#
|
||||
create table t1 (a smallint primary key auto_increment);
|
||||
insert into t1 values(32766),(NULL);
|
||||
delete from t1 where a=32767;
|
||||
insert into t1 values(NULL);
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
drop table t1;
|
@ -529,6 +529,8 @@ SUCCESS
|
||||
# 13. Read-write statement: INSERT IGNORE, change 0 rows.
|
||||
#
|
||||
insert ignore t1 set a=2;
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '2' for key 'a'
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
|
@ -2396,6 +2396,8 @@ a b
|
||||
drop table t1;
|
||||
create table if not exists t1 (a int unique, b int)
|
||||
ignore select 1 as a, 1 as b union select 1 as a, 2 as b;
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '1' for key 'a'
|
||||
select * from t1;
|
||||
a b
|
||||
1 1
|
||||
|
8
mysql-test/r/datetime_456.result
Normal file
8
mysql-test/r/datetime_456.result
Normal file
@ -0,0 +1,8 @@
|
||||
create table t1 (d datetime);
|
||||
insert t1 values (addtime('9999-12-31 23:59:59', '00:00:01')),
|
||||
(from_days(3652499));
|
||||
select * from t1;
|
||||
d
|
||||
NULL
|
||||
NULL
|
||||
drop table t1;
|
@ -1687,7 +1687,6 @@ SELECT t.b, t.c, t1.a
|
||||
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
|
||||
WHERE t.b AND t.c = t1.a;
|
||||
b c a
|
||||
8 c c
|
||||
EXPLAIN EXTENDED
|
||||
SELECT t.b, t.c, t1.a
|
||||
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
|
||||
@ -1702,7 +1701,6 @@ SELECT t.b, t.c, t1.a
|
||||
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
|
||||
WHERE t.b <> 0 AND t.c = t1.a;
|
||||
b c a
|
||||
8 c c
|
||||
INSERT INTO t3 VALUES (100), (200);
|
||||
EXPLAIN EXTENDED
|
||||
SELECT t.b, t.c, t1.a
|
||||
@ -1718,7 +1716,7 @@ SELECT t.b, t.c, t1.a
|
||||
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
|
||||
WHERE t.b AND t.c = t1.a;
|
||||
b c a
|
||||
8 c c
|
||||
NULL NULL c
|
||||
EXPLAIN EXTENDED
|
||||
SELECT t.b, t.c, t1.a
|
||||
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
|
||||
@ -1733,7 +1731,7 @@ SELECT t.b, t.c, t1.a
|
||||
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
|
||||
WHERE t.b <> 0 AND t.c = t1.a;
|
||||
b c a
|
||||
8 c c
|
||||
NULL NULL c
|
||||
SET optimizer_switch=@save_optimizer_switch;
|
||||
DROP TABLE t1,t2,t3;
|
||||
#
|
||||
|
@ -160,3 +160,11 @@ ERROR 42S22: Unknown column '' in 'VALUES() function'
|
||||
INSERT INTO t2(a,b) VALUES (1,0) ON DUPLICATE KEY UPDATE
|
||||
b=(SELECT VALUES(a)+2 FROM t1);
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# MDEV-492: incorrect error check before sending OK in mysql_update
|
||||
#
|
||||
CREATE TABLE t1 (a CHAR(3), b BLOB);
|
||||
UPDATE t1 SET a = 'new'
|
||||
WHERE COLUMN_CREATE( 1, 'v', 1, 'w' ) IS NULL;
|
||||
ERROR 22007: Illegal value used as argument of dynamic column function
|
||||
drop table t1;
|
||||
|
140
mysql-test/r/features.result
Normal file
140
mysql-test/r/features.result
Normal file
@ -0,0 +1,140 @@
|
||||
drop table if exists t1;
|
||||
show status like "feature%";
|
||||
Variable_name Value
|
||||
Feature_dynamic_columns 0
|
||||
Feature_fulltext 0
|
||||
Feature_gis 0
|
||||
Feature_locale 0
|
||||
Feature_subquery 0
|
||||
Feature_timezone 0
|
||||
Feature_trigger 0
|
||||
Feature_xml 0
|
||||
#
|
||||
# Feature GIS
|
||||
#
|
||||
CREATE TABLE t1 (g POINT);
|
||||
SHOW FIELDS FROM t1;
|
||||
Field Type Null Key Default Extra
|
||||
g point YES NULL
|
||||
INSERT INTO t1 VALUES
|
||||
(PointFromText('POINT(10 10)')),
|
||||
(PointFromText('POINT(20 10)')),
|
||||
(PointFromText('POINT(20 20)')),
|
||||
(PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
|
||||
drop table t1;
|
||||
show status like "feature_gis";
|
||||
Variable_name Value
|
||||
Feature_gis 3
|
||||
#
|
||||
# Feature dynamic columns
|
||||
#
|
||||
set @a= COLUMN_CREATE(1, 1212 AS int);
|
||||
set @b= column_add(@a, 2, 1212 as integer);
|
||||
select column_get(@b, 2 as integer);
|
||||
column_get(@b, 2 as integer)
|
||||
1212
|
||||
show status like "feature_dynamic_columns";
|
||||
Variable_name Value
|
||||
Feature_dynamic_columns 2
|
||||
#
|
||||
# Feature fulltext
|
||||
#
|
||||
CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)) engine=myisam;
|
||||
INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
|
||||
('Full-text indexes', 'are called collections'),
|
||||
('Only MyISAM tables','support collections'),
|
||||
('Function MATCH ... AGAINST()','is used to do a search'),
|
||||
('Full-text search in MySQL', 'implements vector space model');
|
||||
select * from t1 where MATCH(a,b) AGAINST ("collections");
|
||||
a b
|
||||
Only MyISAM tables support collections
|
||||
Full-text indexes are called collections
|
||||
select * from t1 where MATCH(a,b) AGAINST ("indexes");
|
||||
a b
|
||||
Full-text indexes are called collections
|
||||
drop table t1;
|
||||
show status like "feature_fulltext";
|
||||
Variable_name Value
|
||||
Feature_fulltext 2
|
||||
#
|
||||
# Feature locale
|
||||
#
|
||||
SET lc_messages=sr_RS;
|
||||
SET lc_messages=en_US;
|
||||
show status like "feature_locale";
|
||||
Variable_name Value
|
||||
Feature_locale 2
|
||||
#
|
||||
# Feature subquery
|
||||
#
|
||||
select (select 2);
|
||||
(select 2)
|
||||
2
|
||||
SELECT (SELECT 1) UNION SELECT (SELECT 2);
|
||||
(SELECT 1)
|
||||
1
|
||||
2
|
||||
create table t1 (a int);
|
||||
insert into t1 values (2);
|
||||
select (select a from t1 where t1.a=t2.a), a from t1 as t2;
|
||||
(select a from t1 where t1.a=t2.a) a
|
||||
2 2
|
||||
drop table t1;
|
||||
show status like "feature_subquery";
|
||||
Variable_name Value
|
||||
Feature_subquery 4
|
||||
#
|
||||
# Feature timezone
|
||||
#
|
||||
SELECT FROM_UNIXTIME(unix_timestamp()) > "1970-01-01";
|
||||
FROM_UNIXTIME(unix_timestamp()) > "1970-01-01"
|
||||
1
|
||||
set time_zone="+03:00";
|
||||
SELECT FROM_UNIXTIME(unix_timestamp()) > "1970-01-01";
|
||||
FROM_UNIXTIME(unix_timestamp()) > "1970-01-01"
|
||||
1
|
||||
set time_zone= @@global.time_zone;
|
||||
show status like "feature_timezone";
|
||||
Variable_name Value
|
||||
Feature_timezone 1
|
||||
#
|
||||
# Feature triggers
|
||||
#
|
||||
create table t1 (i int);
|
||||
# let us test some very simple trigger
|
||||
create trigger trg before insert on t1 for each row set @a:=1;
|
||||
set @a:=0;
|
||||
select @a;
|
||||
@a
|
||||
0
|
||||
insert into t1 values (1),(2);
|
||||
select @a;
|
||||
@a
|
||||
1
|
||||
SHOW TRIGGERS IN test like 't1';
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
|
||||
trg INSERT t1 set @a:=1 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
drop trigger trg;
|
||||
drop table t1;
|
||||
show status like "%trigger%";
|
||||
Variable_name Value
|
||||
Com_create_trigger 1
|
||||
Com_drop_trigger 1
|
||||
Com_show_create_trigger 0
|
||||
Com_show_triggers 1
|
||||
Executed_triggers 2
|
||||
Feature_trigger 2
|
||||
#
|
||||
# Feature xml
|
||||
#
|
||||
SET @xml='<a aa1="aa1" aa2="aa2">a1<b ba1="ba1">b1<c>c1</c>b2</b>a2</a>';
|
||||
SELECT extractValue(@xml,'/a');
|
||||
extractValue(@xml,'/a')
|
||||
a1 a2
|
||||
select updatexml('<div><div><span>1</span><span>2</span></div></div>',
|
||||
'/','<tr><td>1</td><td>2</td></tr>') as upd1;
|
||||
upd1
|
||||
<tr><td>1</td><td>2</td></tr>
|
||||
show status like "feature_xml";
|
||||
Variable_name Value
|
||||
Feature_xml 2
|
@ -1922,3 +1922,5 @@ cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetime(6))
|
||||
select microsecond('12:00:00.123456'), microsecond('2009-12-31 23:59:59.000010');
|
||||
microsecond('12:00:00.123456') microsecond('2009-12-31 23:59:59.000010')
|
||||
123456 10
|
||||
select now(258);
|
||||
ERROR 42000: Too big precision 258 specified for 'now'. Maximum is 6.
|
||||
|
@ -1428,6 +1428,29 @@ WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
|
||||
count(*)
|
||||
1
|
||||
DROP DATABASE gis_ogs;
|
||||
#
|
||||
# BUG #1043845 st_distance() results are incorrect depending on variable order
|
||||
#
|
||||
select st_distance(geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
|
||||
-95.9673057475387 36.1344478941074,
|
||||
-95.9673063519371 36.134484524621,
|
||||
-95.9673049102515 36.1343976584193)'),
|
||||
geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)')) ;
|
||||
st_distance(geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
|
||||
-95.9673057475387 36.1344478941074,
|
||||
-95.9673063519371 36.134484524621,
|
||||
|
||||
0.008148695928146028
|
||||
select st_distance(geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)'),
|
||||
geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
|
||||
-95.9673057475387 36.1344478941074,
|
||||
-95.9673063519371 36.134484524621,
|
||||
-95.9673049102515 36.1343976584193) ')) ;
|
||||
st_distance(geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)'),
|
||||
geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
|
||||
-95.9673057475387 36.1344478941074,
|
||||
-95.9673063519371 36.
|
||||
0.008148695928146028
|
||||
USE test;
|
||||
#
|
||||
# BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS
|
||||
|
@ -313,7 +313,7 @@ alter table t1 add index i3(key3);
|
||||
update t1 set key2=key1,key3=key1;
|
||||
explain select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge i2,i3 i3,i2 4,4 NULL 9 Using sort_union(i3,i2); Using where
|
||||
1 SIMPLE t1 index_merge i2,i3 i3,i2 4,4 NULL REF Using sort_union(i3,i2); Using where
|
||||
select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40);
|
||||
key1 key2 key3
|
||||
31 31 31
|
||||
|
@ -1146,7 +1146,7 @@ alter table t1 add index i3(key3);
|
||||
update t1 set key2=key1,key3=key1;
|
||||
explain select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge i2,i3 i3,i2 4,4 NULL 11 Using sort_union(i3,i2); Using where
|
||||
1 SIMPLE t1 index_merge i2,i3 i3,i2 4,4 NULL REF Using sort_union(i3,i2); Using where
|
||||
select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40);
|
||||
key1 key2 key3
|
||||
31 31 31
|
||||
|
@ -327,9 +327,11 @@ select row_count();
|
||||
row_count()
|
||||
3
|
||||
insert ignore into t1 values (1, 1);
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '1' for key 'PRIMARY'
|
||||
select row_count();
|
||||
row_count()
|
||||
0
|
||||
-1
|
||||
replace into t1 values (1, 11);
|
||||
select row_count();
|
||||
row_count()
|
||||
@ -371,7 +373,15 @@ drop table t1,t2;
|
||||
create table t1 (id int primary key auto_increment, data int, unique(data));
|
||||
insert ignore into t1 values(NULL,100),(NULL,110),(NULL,120);
|
||||
insert ignore into t1 values(NULL,10),(NULL,20),(NULL,110),(NULL,120),(NULL,100),(NULL,90);
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '110' for key 'data'
|
||||
Warning 1062 Duplicate entry '120' for key 'data'
|
||||
Warning 1062 Duplicate entry '100' for key 'data'
|
||||
insert ignore into t1 values(NULL,130),(NULL,140),(500,110),(550,120),(450,100),(NULL,150);
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '110' for key 'data'
|
||||
Warning 1062 Duplicate entry '120' for key 'data'
|
||||
Warning 1062 Duplicate entry '100' for key 'data'
|
||||
select * from t1 order by id;
|
||||
id data
|
||||
1 100
|
||||
|
@ -6,6 +6,10 @@ 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 'PRIMARY'
|
||||
insert ignore into t2 (payoutID) SELECT payoutID+10 FROM t1;
|
||||
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'
|
||||
select * from t2;
|
||||
payoutID
|
||||
1
|
||||
|
@ -172,11 +172,15 @@ DROP TABLE t2;
|
||||
create table t1 (a int not null unique) engine=myisam;
|
||||
insert into t1 values (1),(2);
|
||||
insert ignore into t1 select 1 on duplicate key update a=2;
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '2' for key 'a'
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
insert ignore into t1 select a from t1 as t2 on duplicate key update a=t1.a+1 ;
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '2' for key 'a'
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
|
73
mysql-test/r/last_value.result
Normal file
73
mysql-test/r/last_value.result
Normal file
@ -0,0 +1,73 @@
|
||||
drop table if exists t1;
|
||||
drop database if exists mysqltest;
|
||||
CREATE TABLE t1 (a INT, b INT, c INT, d INT);
|
||||
INSERT INTO t1 VALUES (1,3,0,NULL),(2,2,0,NULL),(3,4,0,NULL),(4,2,0,NULL);
|
||||
SELECT * FROM t1;
|
||||
a b c d
|
||||
1 3 0 NULL
|
||||
2 2 0 NULL
|
||||
3 4 0 NULL
|
||||
4 2 0 NULL
|
||||
UPDATE t1 SET c=LAST_VALUE(@last_a:=a,@last_b:=b,@last_c:=c,1), d=4211 WHERE c=0 ORDER BY b DESC LIMIT 1;
|
||||
SELECT @last_a, @last_b, @last_c;
|
||||
@last_a @last_b @last_c
|
||||
3 4 0
|
||||
SELECT * FROM t1;
|
||||
a b c d
|
||||
1 3 0 NULL
|
||||
2 2 0 NULL
|
||||
3 4 1 4211
|
||||
4 2 0 NULL
|
||||
DROP TABLE t1;
|
||||
SELECT LAST_VALUE(@last_a:=1,@last_b:=1);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def LAST_VALUE(@last_a:=1,@last_b:=1) 8 1 1 N 32897 0 63
|
||||
LAST_VALUE(@last_a:=1,@last_b:=1)
|
||||
1
|
||||
select @last_b;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def @last_b 8 20 1 Y 32896 0 63
|
||||
@last_b
|
||||
1
|
||||
SELECT LAST_VALUE(@last_a:=1,@last_b:=1.0);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def LAST_VALUE(@last_a:=1,@last_b:=1.0) 246 4 3 N 32897 1 63
|
||||
LAST_VALUE(@last_a:=1,@last_b:=1.0)
|
||||
1.0
|
||||
select @last_b;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def @last_b 246 83 3 Y 32896 30 63
|
||||
@last_b
|
||||
1.0
|
||||
SELECT LAST_VALUE(@last_a:=1,@last_b:="hello");
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def LAST_VALUE(@last_a:=1,@last_b:="hello") 253 5 5 N 1 31 8
|
||||
LAST_VALUE(@last_a:=1,@last_b:="hello")
|
||||
hello
|
||||
select @last_b;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def @last_b 250 16777215 5 Y 0 31 8
|
||||
@last_b
|
||||
hello
|
||||
SELECT date(LAST_VALUE(@last_a:=1,@last_b:="2001-02-03"));
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def date(LAST_VALUE(@last_a:=1,@last_b:="2001-02-03")) 10 10 10 Y 128 0 63
|
||||
date(LAST_VALUE(@last_a:=1,@last_b:="2001-02-03"))
|
||||
2001-02-03
|
||||
select @last_b;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def @last_b 250 16777215 10 Y 0 31 8
|
||||
@last_b
|
||||
2001-02-03
|
||||
SELECT LAST_VALUE(@last_a:=1,@last_b:="2001-02-03",NULL);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def LAST_VALUE(@last_a:=1,@last_b:="2001-02-03",NULL) 6 0 0 Y 32896 0 63
|
||||
LAST_VALUE(@last_a:=1,@last_b:="2001-02-03",NULL)
|
||||
NULL
|
||||
select @last_b;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def @last_b 250 16777215 10 Y 0 31 8
|
||||
@last_b
|
||||
2001-02-03
|
||||
SELECT LAST_VALUE();
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
|
@ -702,6 +702,8 @@ id
|
||||
2
|
||||
99
|
||||
insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D');
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '1-1' for key 'PRIMARY'
|
||||
commit;
|
||||
select id,id3 from t1;
|
||||
id id3
|
||||
|
@ -278,6 +278,8 @@ bb-1 NULL cc-2 NULL-1
|
||||
drop table t1, t2, t3, t4;
|
||||
create table t1 (a int, b int not null,unique key (a,b),index(b));
|
||||
insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6);
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '6-6' for key 'a'
|
||||
create table t2 like t1;
|
||||
insert into t2 select * from t1;
|
||||
alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10));
|
||||
|
@ -923,7 +923,6 @@ key-cache-age-threshold 300
|
||||
key-cache-block-size 1024
|
||||
key-cache-division-limit 100
|
||||
key-cache-segments 0
|
||||
language MYSQL_SHAREDIR/
|
||||
large-pages FALSE
|
||||
lc-messages en_US
|
||||
lc-messages-dir MYSQL_SHAREDIR/
|
||||
|
@ -1,6 +1,8 @@
|
||||
drop table if exists t1,t2;
|
||||
create table t1 (a int, b int not null,unique key (a,b),index(b)) engine=myisam;
|
||||
insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6);
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '6-6' for key 'a'
|
||||
explain select * from t1 where a is null;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref a a 5 const 3 Using where; Using index
|
||||
|
@ -787,7 +787,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 pNULL,p2001-01-01 index a a 4 NULL 4 Using where; Using index
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1999-02-31';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 pNULL ref a a 4 const 1 Using where; Using index
|
||||
1 SIMPLE t1 pNULL ref a a 4 const 1 Using index
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index
|
||||
@ -1116,7 +1116,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p2001-01-01,pNULL index a a 4 NULL 4 Using where; Using index
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1999-02-31';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 pNULL ref a a 4 const 1 Using where; Using index
|
||||
1 SIMPLE t1 pNULL ref a a 4 const 1 Using index
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index
|
||||
@ -1445,7 +1445,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p2001-01-01,pNULL index a a 4 NULL 4 Using where; Using index
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1999-02-31';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 pNULL ref a a 4 const 1 Using where; Using index
|
||||
1 SIMPLE t1 pNULL ref a a 4 const 1 Using index
|
||||
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00';
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 4 Using where; Using index
|
||||
|
@ -13,9 +13,9 @@ drop table t1;
|
||||
create table t1 (a tinyint not null auto_increment primary key, b char(20) default "default_value");
|
||||
insert into t1 values (126,"first"),(63, "middle"),(0,"last");
|
||||
insert into t1 values (0,"error");
|
||||
ERROR 23000: Duplicate entry '127' for key 'PRIMARY'
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
replace into t1 values (0,"error");
|
||||
ERROR 23000: Duplicate entry '127' for key 'PRIMARY'
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
replace into t1 values (126,"first updated");
|
||||
replace into t1 values (63,default);
|
||||
select * from t1;
|
||||
|
@ -20,9 +20,7 @@ count(*)
|
||||
0
|
||||
set @@sql_mode=@org_mode;
|
||||
insert into t1 values(null);
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'a' at row 1
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
select * from t1;
|
||||
a
|
||||
127
|
||||
drop table t1;
|
||||
|
@ -20,9 +20,7 @@ count(*)
|
||||
0
|
||||
set @@sql_mode=@org_mode;
|
||||
insert into t1 values(null);
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'a' at row 1
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
select * from t1;
|
||||
a
|
||||
127
|
||||
drop table t1;
|
||||
|
@ -20,9 +20,7 @@ count(*)
|
||||
0
|
||||
set @@sql_mode=@org_mode;
|
||||
insert into t1 values(null);
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'a' at row 1
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
select * from t1;
|
||||
a
|
||||
127
|
||||
drop table t1;
|
||||
|
@ -206,6 +206,165 @@ default(a)
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
DROP TABLE t;
|
||||
#
|
||||
# LP BUG#1009187, MDEV-373, MYSQL bug#58628
|
||||
# Wrong result for a query with [NOT] IN subquery predicate if
|
||||
# the left part of the predicate is explicit NULL
|
||||
#
|
||||
CREATE TABLE t1 (pk INT NOT NULL, i INT NOT NULL);
|
||||
INSERT INTO t1 VALUES (0,10), (1,20), (2,30), (3,40);
|
||||
CREATE TABLE t2a (pk INT NOT NULL, i INT NOT NULL, PRIMARY KEY(i,pk));
|
||||
INSERT INTO t2a VALUES (0,0), (1,1), (2,2), (3,3);
|
||||
CREATE TABLE t2b (pk INT, i INT);
|
||||
INSERT INTO t2b VALUES (0,0), (1,1), (2,2), (3,3);
|
||||
CREATE TABLE t2c (pk INT NOT NULL, i INT NOT NULL);
|
||||
INSERT INTO t2c VALUES (0,0), (1,1), (2,2), (3,3);
|
||||
create index it2c on t2c (i,pk);
|
||||
CREATE TABLE t2d (pk INT NOT NULL, i INT NOT NULL, PRIMARY KEY(i));
|
||||
INSERT INTO t2d VALUES (0,0), (1,1), (2,2), (3,3);
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
|
||||
2 DEPENDENT SUBQUERY t2a unique_subquery PRIMARY PRIMARY 8 const,test.t1.pk 1 Using index; Using where; Full scan on NULL key
|
||||
SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk);
|
||||
pk i
|
||||
SELECT * FROM t1 WHERE 1+NULL NOT IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk);
|
||||
pk i
|
||||
SELECT * FROM t1 WHERE NULL IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk) IS UNKNOWN;
|
||||
pk i
|
||||
0 10
|
||||
1 20
|
||||
2 30
|
||||
3 40
|
||||
SELECT t1.pk, NULL NOT IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk) FROM t1;
|
||||
pk NULL NOT IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk)
|
||||
0 NULL
|
||||
1 NULL
|
||||
2 NULL
|
||||
3 NULL
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2b.i FROM t2b WHERE t2b.pk = t1.pk);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
|
||||
2 DEPENDENT SUBQUERY t2b ALL NULL NULL NULL NULL 4 Using where
|
||||
SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2b.i FROM t2b WHERE t2b.pk = t1.pk);
|
||||
pk i
|
||||
SELECT * FROM t1 WHERE NULL IN (SELECT t2b.i FROM t2b WHERE t2b.pk = t1.pk) IS UNKNOWN;
|
||||
pk i
|
||||
0 10
|
||||
1 20
|
||||
2 30
|
||||
3 40
|
||||
SELECT t1.pk, NULL NOT IN (SELECT t2b.i FROM t2b WHERE t2b.pk = t1.pk) FROM t1;
|
||||
pk NULL NOT IN (SELECT t2b.i FROM t2b WHERE t2b.pk = t1.pk)
|
||||
0 NULL
|
||||
1 NULL
|
||||
2 NULL
|
||||
3 NULL
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2c.i FROM t2c WHERE t2c.pk = t1.pk);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
|
||||
2 DEPENDENT SUBQUERY t2c index_subquery it2c it2c 8 const,test.t1.pk 2 Using index; Using where; Full scan on NULL key
|
||||
SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2c.i FROM t2c WHERE t2c.pk = t1.pk);
|
||||
pk i
|
||||
SELECT * FROM t1 WHERE NULL IN (SELECT t2c.i FROM t2c WHERE t2c.pk = t1.pk) IS UNKNOWN;
|
||||
pk i
|
||||
0 10
|
||||
1 20
|
||||
2 30
|
||||
3 40
|
||||
SELECT t1.pk, NULL NOT IN (SELECT t2c.i FROM t2c WHERE t2c.pk = t1.pk) FROM t1;
|
||||
pk NULL NOT IN (SELECT t2c.i FROM t2c WHERE t2c.pk = t1.pk)
|
||||
0 NULL
|
||||
1 NULL
|
||||
2 NULL
|
||||
3 NULL
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2d.i FROM t2d WHERE t2d.pk = t1.pk);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
|
||||
2 DEPENDENT SUBQUERY t2d const PRIMARY PRIMARY 4 const 1 Using where; Full scan on NULL key
|
||||
SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2d.i FROM t2d WHERE t2d.pk = t1.pk);
|
||||
pk i
|
||||
SELECT * FROM t1 WHERE NULL IN (SELECT t2d.i FROM t2d WHERE t2d.pk = t1.pk) IS UNKNOWN;
|
||||
pk i
|
||||
0 10
|
||||
1 20
|
||||
2 30
|
||||
3 40
|
||||
SELECT t1.pk, NULL NOT IN (SELECT t2d.i FROM t2d WHERE t2d.pk = t1.pk) FROM t1;
|
||||
pk NULL NOT IN (SELECT t2d.i FROM t2d WHERE t2d.pk = t1.pk)
|
||||
0 NULL
|
||||
1 NULL
|
||||
2 NULL
|
||||
3 NULL
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2a.i, t2a.pk FROM t2a WHERE t2a.pk = t1.pk);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
|
||||
2 DEPENDENT SUBQUERY t2a eq_ref PRIMARY PRIMARY 8 const,test.t1.pk 1 Using where; Using index; Full scan on NULL key
|
||||
SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2a.i, t2a.pk FROM t2a WHERE t2a.pk = t1.pk);
|
||||
pk i
|
||||
0 10
|
||||
2 30
|
||||
3 40
|
||||
SELECT (NULL, 1) NOT IN (SELECT t2a.i, t2a.pk FROM t2a WHERE t2a.pk = t1.pk) from t1;
|
||||
(NULL, 1) NOT IN (SELECT t2a.i, t2a.pk FROM t2a WHERE t2a.pk = t1.pk)
|
||||
1
|
||||
NULL
|
||||
1
|
||||
1
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2b.i, t2b.pk FROM t2b WHERE t2b.pk = t1.pk);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
|
||||
2 DEPENDENT SUBQUERY t2b ALL NULL NULL NULL NULL 4 Using where
|
||||
SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2b.i, t2b.pk FROM t2b WHERE t2b.pk = t1.pk);
|
||||
pk i
|
||||
0 10
|
||||
2 30
|
||||
3 40
|
||||
SELECT (NULL, 1) NOT IN (SELECT t2b.i, t2b.pk FROM t2b WHERE t2b.pk = t1.pk) from t1;
|
||||
(NULL, 1) NOT IN (SELECT t2b.i, t2b.pk FROM t2b WHERE t2b.pk = t1.pk)
|
||||
1
|
||||
NULL
|
||||
1
|
||||
1
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2c.i, t2c.pk FROM t2c WHERE t2c.pk = t1.pk);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
|
||||
2 DEPENDENT SUBQUERY t2c ref it2c it2c 8 const,test.t1.pk 2 Using where; Using index; Full scan on NULL key
|
||||
SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2c.i, t2c.pk FROM t2c WHERE t2c.pk = t1.pk);
|
||||
pk i
|
||||
0 10
|
||||
2 30
|
||||
3 40
|
||||
SELECT (NULL, 1) NOT IN (SELECT t2c.i, t2c.pk FROM t2c WHERE t2c.pk = t1.pk) from t1;
|
||||
(NULL, 1) NOT IN (SELECT t2c.i, t2c.pk FROM t2c WHERE t2c.pk = t1.pk)
|
||||
1
|
||||
NULL
|
||||
1
|
||||
1
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2d.i, t2d.pk FROM t2d WHERE t2d.pk = t1.pk);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
|
||||
2 DEPENDENT SUBQUERY t2d const PRIMARY PRIMARY 4 const 1 Using where; Full scan on NULL key
|
||||
SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2d.i, t2d.pk FROM t2d WHERE t2d.pk = t1.pk);
|
||||
pk i
|
||||
0 10
|
||||
2 30
|
||||
3 40
|
||||
SELECT (NULL, 1) NOT IN (SELECT t2d.i, t2d.pk FROM t2d WHERE t2d.pk = t1.pk) from t1;
|
||||
(NULL, 1) NOT IN (SELECT t2d.i, t2d.pk FROM t2d WHERE t2d.pk = t1.pk)
|
||||
1
|
||||
NULL
|
||||
1
|
||||
1
|
||||
drop table t1, t2a, t2b, t2c, t2d;
|
||||
#
|
||||
# End of 5.1 tests.
|
||||
#
|
||||
#
|
||||
|
@ -165,6 +165,8 @@ select @log;
|
||||
(BEFORE_INSERT: new=(id=1, data=1))(AFTER_INSERT: new=(id=1, data=1))
|
||||
set @log:= "";
|
||||
insert ignore t1 values (1, 2);
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '1' for key 'PRIMARY'
|
||||
select @log;
|
||||
@log
|
||||
(BEFORE_INSERT: new=(id=1, data=2))
|
||||
|
@ -209,15 +209,11 @@ a
|
||||
SET SQL_MODE=TRADITIONAL;
|
||||
EXPLAIN SELECT * FROM t1 WHERE a = '0000-00-00';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref i i 4 const 1 Using where; Using index
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'a' at row 1
|
||||
1 SIMPLE t1 ref i i 4 const 1 Using index
|
||||
SELECT * FROM t1 WHERE a = '0000-00-00';
|
||||
a
|
||||
0000-00-00
|
||||
0000-00-00
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'a' at row 1
|
||||
SELECT * FROM t2 WHERE a = '0000-00-00';
|
||||
a
|
||||
0000-00-00
|
||||
@ -242,15 +238,11 @@ a
|
||||
SET SQL_MODE=TRADITIONAL;
|
||||
EXPLAIN SELECT * FROM t1 WHERE a = '1000-00-00';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref i i 4 const 1 Using where; Using index
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'a' at row 1
|
||||
1 SIMPLE t1 ref i i 4 const 1 Using index
|
||||
SELECT * FROM t1 WHERE a = '1000-00-00';
|
||||
a
|
||||
1000-00-00
|
||||
1000-00-00
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'a' at row 1
|
||||
SELECT * FROM t2 WHERE a = '1000-00-00';
|
||||
a
|
||||
1000-00-00
|
||||
|
@ -4678,6 +4678,7 @@ DROP TABLE t1,t2,t3;
|
||||
# LP bug#1007622 Server crashes in handler::increment_statistics on
|
||||
# inserting into a view over a view
|
||||
#
|
||||
flush status;
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE ALGORITHM=MERGE VIEW v1 AS SELECT a1.* FROM t1 AS a1, t1 AS a2;
|
||||
CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM v1;
|
||||
@ -4687,6 +4688,48 @@ a
|
||||
1
|
||||
drop view v2,v1;
|
||||
drop table t1;
|
||||
show status like '%view%';
|
||||
Variable_name Value
|
||||
Com_create_view 2
|
||||
Com_drop_view 1
|
||||
Opened_views 3
|
||||
show status like 'Opened_table%';
|
||||
Variable_name Value
|
||||
Opened_table_definitions 2
|
||||
Opened_tables 3
|
||||
#
|
||||
# MDEV-486 LP BUG#1010116 Incorrect query results in
|
||||
# view and derived tables
|
||||
#
|
||||
SELECT
|
||||
`Derived1`.`id`,
|
||||
`Derived2`.`Val1`
|
||||
FROM (select 30631 as `id`) AS `Derived1` LEFT OUTER JOIN (SELECT
|
||||
2 as `id`,
|
||||
1 AS `Val1`
|
||||
FROM (select 30631 as `id`) AS `Derived3`) AS `Derived2` ON `Derived1`.`id` = `Derived2`.`id`;
|
||||
id Val1
|
||||
30631 NULL
|
||||
create table t1 ( id int );
|
||||
insert into t1 values (30631);
|
||||
create table t2 ( id int );
|
||||
insert into t2 values (30631);
|
||||
create algorithm=MERGE view v2 as select 2 as id, 1 as val1 from t2;
|
||||
select t1.*, v2.* from t1 left join v2 on t1.id = v2.id;
|
||||
id id val1
|
||||
30631 NULL NULL
|
||||
drop view v2;
|
||||
drop table t1,t2;
|
||||
create table t1 ( id int );
|
||||
insert into t1 values (30631);
|
||||
create table t2 ( id int );
|
||||
insert into t2 values (30631);
|
||||
create algorithm=MERGE view v2 as select 2 as id, id is null as bbb, id as iddqd, 1 as val1 from t2;
|
||||
select t1.*, v2.* from t1 left join v2 on t1.id = v2.id;
|
||||
id id bbb iddqd val1
|
||||
30631 NULL NULL NULL NULL
|
||||
drop view v2;
|
||||
drop table t1,t2;
|
||||
# -----------------------------------------------------------------
|
||||
# -- End of 5.3 tests.
|
||||
# -----------------------------------------------------------------
|
||||
|
@ -276,6 +276,8 @@ bb-1 NULL cc-2 NULL-1
|
||||
drop table t1, t2, t3, t4;
|
||||
create table t1 (a int, b int not null,unique key (a,b),index(b));
|
||||
insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6);
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '6-6' for key 'a'
|
||||
create table t2 like t1;
|
||||
insert into t2 select * from t1;
|
||||
alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10));
|
||||
|
@ -69,6 +69,8 @@ INSERT INTO t1 VALUES (1);
|
||||
START TRANSACTION;
|
||||
INSERT INTO t2 VALUES (1);
|
||||
INSERT IGNORE INTO t1 VALUES (1);
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '1' for key 'PRIMARY'
|
||||
COMMIT;
|
||||
INSERT INTO t1 VALUES (2);
|
||||
START TRANSACTION;
|
||||
|
@ -579,13 +579,46 @@ DROP PROCEDURE p4;
|
||||
End of 5.0 tests
|
||||
reset master;
|
||||
create table t1 (id tinyint auto_increment primary key);
|
||||
insert into t1 values(5);
|
||||
set insert_id=128;
|
||||
insert into t1 values(null);
|
||||
insert into t1 values(null) /* Not binlogged */;
|
||||
ERROR 22003: Out of range value for column 'id' at row 1
|
||||
set insert_id=128;
|
||||
insert ignore into t1 values(null) /* Insert 128 */;
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'id' at row 1
|
||||
Warning 167 Out of range value for column 'id' at row 1
|
||||
set insert_id=5;
|
||||
insert into t1 values(null) /* Not binlogged */;
|
||||
ERROR 23000: Duplicate entry '5' for key 'PRIMARY'
|
||||
set insert_id=5;
|
||||
insert ignore into t1 values(null) /* Insert 5 */;
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '5' for key 'PRIMARY'
|
||||
select * from t1;
|
||||
id
|
||||
127
|
||||
5
|
||||
drop table t1;
|
||||
create table t1 (id tinyint auto_increment primary key) engine=myisam;
|
||||
set insert_id=128;
|
||||
insert into t1 values(5),(null) /* Insert_id 128 */;
|
||||
ERROR 22003: Out of range value for column 'id' at row 2
|
||||
set insert_id=128;
|
||||
insert ignore into t1 values (4),(null) /* Insert_id 128 */;
|
||||
Warnings:
|
||||
Warning 167 Out of range value for column 'id' at row 2
|
||||
set insert_id=5;
|
||||
insert into t1 values(3),(null) /* Insert_id 5 */;
|
||||
ERROR 23000: Duplicate entry '5' for key 'PRIMARY'
|
||||
set insert_id=5;
|
||||
insert ignore into t1 values(2),(null) /* Insert_id 5 */;
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '5' for key 'PRIMARY'
|
||||
select * from t1 order by id;
|
||||
id
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
create table if not exists t2 select * from t1;
|
||||
@ -604,6 +637,24 @@ master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
|
||||
master-bin.000001 # Query # # use `test`; create table t1 (id tinyint auto_increment primary key) engine=myisam
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
|
||||
master-bin.000001 # Query # # use `test`; create table t1 (a int)
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t2` (
|
||||
@ -626,6 +677,7 @@ master-bin.000001 # Table_map # # table_id: # (mysql.user)
|
||||
master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
drop table t1,t2,t3,tt1;
|
||||
reset master;
|
||||
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
|
||||
insert /* before delayed */ delayed /* after delayed */ into t1 values (207);
|
||||
insert /*! delayed */ into t1 values (null);
|
||||
@ -633,35 +685,6 @@ insert delayed into t1 values (300);
|
||||
FLUSH TABLES;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; create table t1 (id tinyint auto_increment primary key)
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
|
||||
master-bin.000001 # Query # # use `test`; create table t1 (a int)
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t2` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t3` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
)
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (mysql.user)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (mysql.user)
|
||||
master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (mysql.user)
|
||||
master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt1` /* generated by server */
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE `t1`,`t2`,`t3` /* generated by server */
|
||||
master-bin.000001 # Query # # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
|
@ -1,3 +1,4 @@
|
||||
reset master;
|
||||
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
|
||||
insert /* before delayed */ delayed /* after delayed */ into t1 values (207);
|
||||
insert /*! delayed */ into t1 values (null);
|
||||
@ -5,9 +6,6 @@ insert delayed into t1 values (300);
|
||||
FLUSH TABLES;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_latin1'Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT' COLLATE 'latin1_swedish_ci'))
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; insert /* before delayed */ /* after delayed */ into t1 values (207)
|
||||
|
@ -388,13 +388,46 @@ DROP PROCEDURE p4;
|
||||
End of 5.0 tests
|
||||
reset master;
|
||||
create table t1 (id tinyint auto_increment primary key);
|
||||
insert into t1 values(5);
|
||||
set insert_id=128;
|
||||
insert into t1 values(null);
|
||||
insert into t1 values(null) /* Not binlogged */;
|
||||
ERROR 22003: Out of range value for column 'id' at row 1
|
||||
set insert_id=128;
|
||||
insert ignore into t1 values(null) /* Insert 128 */;
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'id' at row 1
|
||||
Warning 167 Out of range value for column 'id' at row 1
|
||||
set insert_id=5;
|
||||
insert into t1 values(null) /* Not binlogged */;
|
||||
ERROR 23000: Duplicate entry '5' for key 'PRIMARY'
|
||||
set insert_id=5;
|
||||
insert ignore into t1 values(null) /* Insert 5 */;
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '5' for key 'PRIMARY'
|
||||
select * from t1;
|
||||
id
|
||||
127
|
||||
5
|
||||
drop table t1;
|
||||
create table t1 (id tinyint auto_increment primary key) engine=myisam;
|
||||
set insert_id=128;
|
||||
insert into t1 values(5),(null) /* Insert_id 128 */;
|
||||
ERROR 22003: Out of range value for column 'id' at row 2
|
||||
set insert_id=128;
|
||||
insert ignore into t1 values (4),(null) /* Insert_id 128 */;
|
||||
Warnings:
|
||||
Warning 167 Out of range value for column 'id' at row 2
|
||||
set insert_id=5;
|
||||
insert into t1 values(3),(null) /* Insert_id 5 */;
|
||||
ERROR 23000: Duplicate entry '5' for key 'PRIMARY'
|
||||
set insert_id=5;
|
||||
insert ignore into t1 values(2),(null) /* Insert_id 5 */;
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '5' for key 'PRIMARY'
|
||||
select * from t1 order by id;
|
||||
id
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
create table if not exists t2 select * from t1;
|
||||
@ -409,8 +442,33 @@ show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; create table t1 (id tinyint auto_increment primary key)
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Intvar # # INSERT_ID=127
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values(null)
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values(5)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Intvar # # INSERT_ID=128
|
||||
master-bin.000001 # Query # # use `test`; insert ignore into t1 values(null) /* Insert 128 */
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Intvar # # INSERT_ID=5
|
||||
master-bin.000001 # Query # # use `test`; insert ignore into t1 values(null) /* Insert 5 */
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
|
||||
master-bin.000001 # Query # # use `test`; create table t1 (id tinyint auto_increment primary key) engine=myisam
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Intvar # # INSERT_ID=128
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values(5),(null) /* Insert_id 128 */
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Intvar # # INSERT_ID=128
|
||||
master-bin.000001 # Query # # use `test`; insert ignore into t1 values (4),(null) /* Insert_id 128 */
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Intvar # # INSERT_ID=5
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values(3),(null) /* Insert_id 5 */
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Intvar # # INSERT_ID=5
|
||||
master-bin.000001 # Query # # use `test`; insert ignore into t1 values(2),(null) /* Insert_id 5 */
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
|
||||
master-bin.000001 # Query # # use `test`; create table t1 (a int)
|
||||
@ -427,6 +485,7 @@ master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `mysql`; DELETE FROM user WHERE host='localhost' AND user='@#@'
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
drop table t1,t2,t3,tt1;
|
||||
reset master;
|
||||
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
|
||||
insert /* before delayed */ delayed /* after delayed */ into t1 values (207);
|
||||
insert /*! delayed */ into t1 values (null);
|
||||
@ -434,27 +493,6 @@ insert delayed into t1 values (300);
|
||||
FLUSH TABLES;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; create table t1 (id tinyint auto_increment primary key)
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Intvar # # INSERT_ID=127
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values(null)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
|
||||
master-bin.000001 # Query # # use `test`; create table t1 (a int)
|
||||
master-bin.000001 # Query # # use `test`; create table if not exists t2 select * from t1
|
||||
master-bin.000001 # Query # # use `test`; create temporary table tt1 (a int)
|
||||
master-bin.000001 # Query # # use `test`; create table if not exists t3 like tt1
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `mysql`; INSERT INTO user SET host='localhost', user='@#@', password=password('Just a test')
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `mysql`; UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@'
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `mysql`; DELETE FROM user WHERE host='localhost' AND user='@#@'
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt1` /* generated by server */
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE `t1`,`t2`,`t3` /* generated by server */
|
||||
master-bin.000001 # Query # # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
|
@ -2682,6 +2682,7 @@ CREATE TABLE insert_2_keys (a INT UNIQUE KEY, b INT UNIQUE KEY);
|
||||
INSERT INTO insert_2_keys values (1, 1);
|
||||
INSERT IGNORE INTO insert_table SELECT * FROM filler_table;
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '1' for key 'PRIMARY'
|
||||
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT IGNORE... SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave.
|
||||
TRUNCATE TABLE insert_table;
|
||||
INSERT INTO insert_table SELECT * FROM filler_table ON DUPLICATE KEY UPDATE a = 1;
|
||||
|
@ -427,4 +427,23 @@ INDEX(col_int_key) USING HASH) ENGINE = HEAP;
|
||||
INSERT INTO t1 (col_int_nokey, col_int_key) VALUES (3, 0), (4, 0), (3, 1);
|
||||
DELETE FROM t1 WHERE col_int_nokey = 5 ORDER BY col_int_key LIMIT 2;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #1002564: Wrong result for a lookup query from a heap table
|
||||
#
|
||||
CREATE TABLE t1 (c1 VARCHAR(10) NOT NULL, KEY i1 (c1(3))) ENGINE=MEMORY DEFAULT CHARSET=latin1;
|
||||
INSERT INTO t1 VALUES ('foo1'), ('bar2'), ('baz3');
|
||||
explain SELECT * FROM t1 WHERE c1='bar2';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref i1 i1 5 const 2 Using where
|
||||
SELECT * FROM t1 WHERE c1='bar2';
|
||||
c1
|
||||
bar2
|
||||
ALTER TABLE t1 DROP KEY i1, ADD KEY il (c1(3)) using btree;
|
||||
explain SELECT * FROM t1 WHERE c1='bar2';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref il il 5 const 1 Using where
|
||||
SELECT * FROM t1 WHERE c1='bar2';
|
||||
c1
|
||||
bar2
|
||||
DROP TABLE t1;
|
||||
End of 5.5 tests
|
||||
|
@ -316,4 +316,17 @@ DELETE FROM t1 WHERE col_int_nokey = 5 ORDER BY col_int_key LIMIT 2;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Bug #1002564: Wrong result for a lookup query from a heap table
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (c1 VARCHAR(10) NOT NULL, KEY i1 (c1(3))) ENGINE=MEMORY DEFAULT CHARSET=latin1;
|
||||
INSERT INTO t1 VALUES ('foo1'), ('bar2'), ('baz3');
|
||||
explain SELECT * FROM t1 WHERE c1='bar2';
|
||||
SELECT * FROM t1 WHERE c1='bar2';
|
||||
ALTER TABLE t1 DROP KEY i1, ADD KEY il (c1(3)) using btree;
|
||||
explain SELECT * FROM t1 WHERE c1='bar2';
|
||||
SELECT * FROM t1 WHERE c1='bar2';
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.5 tests
|
||||
|
33
mysql-test/suite/innodb/r/auto_increment_dup.result
Normal file
33
mysql-test/suite/innodb/r/auto_increment_dup.result
Normal file
@ -0,0 +1,33 @@
|
||||
drop table if exists t1;
|
||||
CREATE TABLE t1(
|
||||
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
k INT,
|
||||
c CHAR(1),
|
||||
UNIQUE KEY(k)) ENGINE=InnoDB;
|
||||
#
|
||||
# Connection 1
|
||||
#
|
||||
SET DEBUG_SYNC='ha_write_row_end SIGNAL continue2 WAIT_FOR continue1';
|
||||
affected rows: 0
|
||||
INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1';
|
||||
#
|
||||
# Connection 2
|
||||
#
|
||||
SET DEBUG_SYNC='start_ha_write_row WAIT_FOR continue2';
|
||||
affected rows: 0
|
||||
SET DEBUG_SYNC='after_mysql_insert SIGNAL continue1';
|
||||
affected rows: 0
|
||||
INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2';
|
||||
affected rows: 3
|
||||
info: Records: 3 Duplicates: 0 Warnings: 0
|
||||
affected rows: 4
|
||||
info: Records: 3 Duplicates: 1 Warnings: 0
|
||||
SET DEBUG_SYNC='RESET';
|
||||
SELECT * FROM t1 ORDER BY k;
|
||||
id k c
|
||||
1 1 NULL
|
||||
4 2 1
|
||||
2 3 NULL
|
||||
5 4 NULL
|
||||
6 5 NULL
|
||||
DROP TABLE t1;
|
@ -2,7 +2,7 @@ drop table if exists t1;
|
||||
CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (9223372036854775807, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
ERROR 22003: Out of range value for column 'c1' at row 1
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
9223372036854775807 NULL
|
||||
@ -10,7 +10,7 @@ DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (127, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
ERROR 22003: Out of range value for column 'c1' at row 1
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
127 NULL
|
||||
@ -18,7 +18,7 @@ DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (255, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
ERROR 22003: Out of range value for column 'c1' at row 1
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
255 NULL
|
||||
@ -26,7 +26,7 @@ DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (32767, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
ERROR 22003: Out of range value for column 'c1' at row 1
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
32767 NULL
|
||||
@ -34,7 +34,7 @@ DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (65535, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
ERROR 22003: Out of range value for column 'c1' at row 1
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
65535 NULL
|
||||
@ -42,7 +42,7 @@ DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (8388607, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
ERROR 22003: Out of range value for column 'c1' at row 1
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
8388607 NULL
|
||||
@ -50,7 +50,7 @@ DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (16777215, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
ERROR 22003: Out of range value for column 'c1' at row 1
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
16777215 NULL
|
||||
@ -58,7 +58,7 @@ DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (2147483647, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
ERROR 22003: Out of range value for column 'c1' at row 1
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
2147483647 NULL
|
||||
@ -66,7 +66,7 @@ DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (4294967295, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
ERROR 22003: Out of range value for column 'c1' at row 1
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
4294967295 NULL
|
||||
@ -74,7 +74,7 @@ DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (9223372036854775807, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
ERROR 22003: Out of range value for column 'c1' at row 1
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
9223372036854775807 NULL
|
||||
@ -567,7 +567,7 @@ Variable_name Value
|
||||
auto_increment_increment 65535
|
||||
auto_increment_offset 65535
|
||||
INSERT INTO t1 VALUES (NULL),(NULL);
|
||||
ERROR 22003: Out of range value for column 't1' at row 167
|
||||
ERROR 22003: Out of range value for column 'c1' at row 1
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1
|
||||
@ -858,7 +858,7 @@ PRIMARY KEY) ENGINE=InnoDB;
|
||||
INSERT INTO t2 SELECT c1 FROM t1;
|
||||
Got one of the listed errors
|
||||
INSERT INTO t2 SELECT NULL FROM t1;
|
||||
Got one of the listed errors
|
||||
ERROR 22003: Out of range value for column 'c1' at row 1
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
||||
|
@ -98,8 +98,12 @@ CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(3,1);
|
||||
BEGIN;
|
||||
INSERT IGNORE INTO t1 VALUES(3,14);
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '3' for key 'PRIMARY'
|
||||
BEGIN;
|
||||
INSERT IGNORE INTO t1 VALUES(3,23);
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '3' for key 'PRIMARY'
|
||||
SELECT * FROM t1 FOR UPDATE;
|
||||
COMMIT;
|
||||
a b
|
||||
|
@ -816,6 +816,8 @@ id
|
||||
1
|
||||
2
|
||||
insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D');
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '1-1' for key 'PRIMARY'
|
||||
commit;
|
||||
select id,id3 from t1;
|
||||
id id3
|
||||
|
@ -3,6 +3,6 @@ SET GLOBAL innodb_file_per_table=0;
|
||||
create table bug56947(a int not null) engine = innodb;
|
||||
CREATE TABLE `bug56947#1`(a int) ENGINE=InnoDB;
|
||||
alter table bug56947 add unique index (a);
|
||||
ERROR HY000: Table 'test.bug56947#1' already exists
|
||||
ERROR 42S01: Table 'test.bug56947#1' already exists
|
||||
drop table `bug56947#1`;
|
||||
drop table bug56947;
|
||||
|
@ -1480,10 +1480,15 @@ k a c
|
||||
1 6 2
|
||||
2 7 NULL
|
||||
insert ignore into t2 values (null,6,1),(10,8,1);
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '6' for key 'idx_1'
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
0
|
||||
insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '6' for key 'idx_1'
|
||||
Warning 1062 Duplicate entry '8' for key 'idx_1'
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
11
|
||||
|
51
mysql-test/suite/innodb/t/auto_increment_dup.test
Normal file
51
mysql-test/suite/innodb/t/auto_increment_dup.test
Normal file
@ -0,0 +1,51 @@
|
||||
##########################################################################
|
||||
# LP bug #1035225 / MySQL bug #66301: INSERT ... ON DUPLICATE KEY UPDATE +
|
||||
# innodb_autoinc_lock_mode=1 is broken
|
||||
##########################################################################
|
||||
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_debug_sync.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1(
|
||||
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
k INT,
|
||||
c CHAR(1),
|
||||
UNIQUE KEY(k)) ENGINE=InnoDB;
|
||||
|
||||
--enable_info
|
||||
|
||||
--connect(con1, localhost, root)
|
||||
--connect(con2, localhost, root)
|
||||
|
||||
--connection con1
|
||||
|
||||
--echo #
|
||||
--echo # Connection 1
|
||||
--echo #
|
||||
SET DEBUG_SYNC='ha_write_row_end SIGNAL continue2 WAIT_FOR continue1';
|
||||
--send INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1'
|
||||
|
||||
--connection con2
|
||||
--echo #
|
||||
--echo # Connection 2
|
||||
--echo #
|
||||
SET DEBUG_SYNC='start_ha_write_row WAIT_FOR continue2';
|
||||
SET DEBUG_SYNC='after_mysql_insert SIGNAL continue1';
|
||||
INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2';
|
||||
|
||||
--connection con1
|
||||
--reap
|
||||
--disable_info
|
||||
SET DEBUG_SYNC='RESET';
|
||||
SELECT * FROM t1 ORDER BY k;
|
||||
|
||||
--disconnect con1
|
||||
--disconnect con2
|
||||
|
||||
--connection default
|
||||
|
||||
DROP TABLE t1;
|
@ -11,7 +11,7 @@ drop table if exists t1;
|
||||
#
|
||||
CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (9223372036854775807, null);
|
||||
-- error ER_DUP_ENTRY,1062
|
||||
-- error 167
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
@ -22,14 +22,14 @@ DROP TABLE t1;
|
||||
# TINYINT
|
||||
CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (127, null);
|
||||
-- error ER_DUP_ENTRY,1062
|
||||
-- error 167
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (255, null);
|
||||
-- error ER_DUP_ENTRY,1062
|
||||
-- error 167
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
@ -38,14 +38,14 @@ DROP TABLE t1;
|
||||
#
|
||||
CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (32767, null);
|
||||
-- error ER_DUP_ENTRY,1062
|
||||
-- error 167
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (65535, null);
|
||||
-- error ER_DUP_ENTRY,1062
|
||||
-- error 167
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
@ -54,14 +54,14 @@ DROP TABLE t1;
|
||||
#
|
||||
CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (8388607, null);
|
||||
-- error ER_DUP_ENTRY,1062
|
||||
-- error 167
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (16777215, null);
|
||||
-- error ER_DUP_ENTRY,1062
|
||||
-- error 167
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
@ -70,14 +70,14 @@ DROP TABLE t1;
|
||||
#
|
||||
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (2147483647, null);
|
||||
-- error ER_DUP_ENTRY,1062
|
||||
-- error 167
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (4294967295, null);
|
||||
-- error ER_DUP_ENTRY,1062
|
||||
-- error 167
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
@ -86,7 +86,7 @@ DROP TABLE t1;
|
||||
#
|
||||
CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (9223372036854775807, null);
|
||||
-- error ER_DUP_ENTRY,1062
|
||||
-- error 167
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
@ -349,7 +349,7 @@ INSERT INTO t1 VALUES (18446744073709551610); #-- 2^64 - 2
|
||||
SELECT * FROM t1;
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976;
|
||||
SHOW VARIABLES LIKE "%auto_inc%";
|
||||
--error ER_WARN_DATA_OUT_OF_RANGE
|
||||
--error 167
|
||||
INSERT INTO t1 VALUES (NULL),(NULL);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
@ -437,7 +437,7 @@ CREATE TABLE t2(
|
||||
PRIMARY KEY) ENGINE=InnoDB;
|
||||
-- error ER_DUP_ENTRY,1062
|
||||
INSERT INTO t2 SELECT c1 FROM t1;
|
||||
-- error ER_DUP_ENTRY,1467
|
||||
-- error 167
|
||||
INSERT INTO t2 SELECT NULL FROM t1;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
|
@ -452,6 +452,8 @@ SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO';
|
||||
CREATE TABLE t1 (id int(11) PRIMARY KEY auto_increment,f1 varchar(10) NOT NULL UNIQUE);
|
||||
INSERT IGNORE INTO t1 (f1) VALUES ("test1");
|
||||
INSERT IGNORE INTO t1 (f1) VALUES ("test1");
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry 'test1' for key 'f1'
|
||||
INSERT IGNORE INTO t1 (f1) VALUES ("test2");
|
||||
SELECT * FROM t1;
|
||||
id f1
|
||||
|
@ -277,6 +277,8 @@ bb-1 NULL cc-2 NULL-1
|
||||
drop table t1, t2, t3, t4;
|
||||
create table t1 (a int, b int not null,unique key (a,b),index(b));
|
||||
insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6);
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '6-6' for key 'a'
|
||||
create table t2 like t1;
|
||||
insert into t2 select * from t1;
|
||||
alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10));
|
||||
|
@ -38,7 +38,11 @@ c1 c2 c3 c4
|
||||
2008-01-01 00:00:00 NULL 2008-01-02 2008-01-03 00:00:00
|
||||
2009-01-29 11:11:27 2009-01-29 00:00:00 2009-01-29 2009-01-29 00:00:00
|
||||
INSERT IGNORE INTO t1(c1,c2) VALUES('20070525','20070527') /* doesnt throw error */;
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '2007-05-25 00:00:00' for key 'PRIMARY'
|
||||
INSERT IGNORE INTO t1(c1,c2) VALUES(19840905,830907) /* doesnt throw error */;
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '1983-09-07 00:00:00' for key 'c2'
|
||||
SELECT * FROM t1 WHERE c1='20070527' /* Returns no rows */;
|
||||
c1 c2 c3 c4
|
||||
INSERT INTO t1(c1) VALUES('20070525') ON DUPLICATE KEY UPDATE c1='20070527';
|
||||
|
@ -1,3 +1,6 @@
|
||||
# Restart of server does not work for embedded.
|
||||
--source include/not_embedded.inc
|
||||
|
||||
source feedback_plugin_load.test;
|
||||
|
||||
if (!$MTR_FEEDBACK_PLUGIN) {
|
||||
|
@ -125,6 +125,10 @@ insert into t1 values(600),(NULL),(NULL);
|
||||
ERROR 23000: Duplicate entry '600' for key 'PRIMARY'
|
||||
set @@insert_id=600;
|
||||
insert ignore into t1 values(600),(NULL),(NULL),(610),(NULL);
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '600' for key 'PRIMARY'
|
||||
Warning 1062 Duplicate entry '600' for key 'PRIMARY'
|
||||
Warning 1062 Duplicate entry '600' for key 'PRIMARY'
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
@ -186,7 +190,7 @@ set auto_increment_offset=4;
|
||||
insert into t1 values(null);
|
||||
insert into t1 values(null);
|
||||
insert into t1 values(null);
|
||||
ERROR 23000: Duplicate entry '125' for key 'PRIMARY'
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t1 order by a;
|
||||
a mod(a-@@auto_increment_offset,@@auto_increment_increment)
|
||||
103 0
|
||||
@ -196,21 +200,19 @@ create table t2 (a tinyint unsigned not null auto_increment primary key) engine=
|
||||
set auto_increment_increment=10;
|
||||
set auto_increment_offset=1;
|
||||
set insert_id=1000;
|
||||
insert into t2 values(10);
|
||||
insert into t2 values(null);
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'a' at row 1
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t2 order by a;
|
||||
a mod(a-@@auto_increment_offset,@@auto_increment_increment)
|
||||
251 0
|
||||
10 9
|
||||
create table t3 like t1;
|
||||
set auto_increment_increment=1000;
|
||||
set auto_increment_offset=700;
|
||||
insert into t3 values(null);
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'a' at row 1
|
||||
ERROR 22003: Out of range value for column 'a' at row 1
|
||||
select * from t3 order by a;
|
||||
a
|
||||
127
|
||||
select * from t1 order by a;
|
||||
a
|
||||
103
|
||||
@ -218,10 +220,9 @@ a
|
||||
125
|
||||
select * from t2 order by a;
|
||||
a
|
||||
251
|
||||
10
|
||||
select * from t3 order by a;
|
||||
a
|
||||
127
|
||||
drop table t1,t2,t3;
|
||||
set auto_increment_increment=1;
|
||||
set auto_increment_offset=1;
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- suite/rpl/r/rpl_insert_delayed.result 2012-02-06 21:37:21.000000000 +0100
|
||||
+++ suite/rpl/r/rpl_insert_delayed,stmt.reject 2012-02-06 23:12:55.000000000 +0100
|
||||
--- suite/rpl/r/rpl_insert_delayed.result 2012-09-18 01:37:45.317521958 +0300
|
||||
+++ suite/rpl/r/rpl_insert_delayed,stmt.reject 2012-09-18 01:36:16.637514667 +0300
|
||||
@@ -15,17 +15,17 @@
|
||||
insert delayed into t1 values(10, "my name");
|
||||
flush table t1;
|
||||
|
@ -14,6 +14,8 @@ select * into outfile 'MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1;
|
||||
drop table t1;
|
||||
create table t1(a int primary key);
|
||||
load data local infile 'MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1;
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '2' for key 'PRIMARY'
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a
|
||||
1
|
||||
|
@ -77,8 +77,8 @@ master-bin.000001 # Query # # use `test`; insert into t1 values(18)
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
*** Test correct USE statement in SHOW BINLOG EVENTS ***
|
||||
set sql_mode = 'ANSI_QUOTES';
|
||||
CREATE DATABASE "db1`; SELECT 'oops!'";
|
||||
use "db1`; SELECT 'oops!'";
|
||||
CREATE DATABASE "db1`; select 'oops!'";
|
||||
use "db1`; select 'oops!'";
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY) engine=MyISAM;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
set sql_mode = '';
|
||||
@ -86,41 +86,41 @@ INSERT INTO t1 VALUES (2);
|
||||
set sql_mode = 'ANSI_QUOTES';
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # CREATE DATABASE "db1`; SELECT 'oops!'"
|
||||
master-bin.000001 # Query # # use "db1`; SELECT 'oops!'"; CREATE TABLE t1 (a INT PRIMARY KEY) engine=MyISAM
|
||||
master-bin.000001 # Query # # CREATE DATABASE "db1`; select 'oops!'"
|
||||
master-bin.000001 # Query # # use "db1`; select 'oops!'"; CREATE TABLE t1 (a INT PRIMARY KEY) engine=MyISAM
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use "db1`; SELECT 'oops!'"; INSERT INTO t1 VALUES (1)
|
||||
master-bin.000001 # Query # # use "db1`; select 'oops!'"; INSERT INTO t1 VALUES (1)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use "db1`; SELECT 'oops!'"; INSERT INTO t1 VALUES (2)
|
||||
master-bin.000001 # Query # # use "db1`; select 'oops!'"; INSERT INTO t1 VALUES (2)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
set sql_mode = '';
|
||||
set sql_quote_show_create = 0;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # CREATE DATABASE "db1`; SELECT 'oops!'"
|
||||
master-bin.000001 # Query # # use `db1``; SELECT 'oops!'`; CREATE TABLE t1 (a INT PRIMARY KEY) engine=MyISAM
|
||||
master-bin.000001 # Query # # CREATE DATABASE "db1`; select 'oops!'"
|
||||
master-bin.000001 # Query # # use `db1``; select 'oops!'`; CREATE TABLE t1 (a INT PRIMARY KEY) engine=MyISAM
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `db1``; SELECT 'oops!'`; INSERT INTO t1 VALUES (1)
|
||||
master-bin.000001 # Query # # use `db1``; select 'oops!'`; INSERT INTO t1 VALUES (1)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `db1``; SELECT 'oops!'`; INSERT INTO t1 VALUES (2)
|
||||
master-bin.000001 # Query # # use `db1``; select 'oops!'`; INSERT INTO t1 VALUES (2)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
set sql_quote_show_create = 1;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # CREATE DATABASE "db1`; SELECT 'oops!'"
|
||||
master-bin.000001 # Query # # use `db1``; SELECT 'oops!'`; CREATE TABLE t1 (a INT PRIMARY KEY) engine=MyISAM
|
||||
master-bin.000001 # Query # # CREATE DATABASE "db1`; select 'oops!'"
|
||||
master-bin.000001 # Query # # use `db1``; select 'oops!'`; CREATE TABLE t1 (a INT PRIMARY KEY) engine=MyISAM
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `db1``; SELECT 'oops!'`; INSERT INTO t1 VALUES (1)
|
||||
master-bin.000001 # Query # # use `db1``; select 'oops!'`; INSERT INTO t1 VALUES (1)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `db1``; SELECT 'oops!'`; INSERT INTO t1 VALUES (2)
|
||||
master-bin.000001 # Query # # use `db1``; select 'oops!'`; INSERT INTO t1 VALUES (2)
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
DROP TABLE t1;
|
||||
use test;
|
||||
***Test LOAD DATA INFILE with various identifiers that need correct quoting ***
|
||||
use `db1``; SELECT 'oops!'`;
|
||||
use `db1``; select 'oops!'`;
|
||||
set timestamp=1000000000;
|
||||
CREATE TABLE `t``1` (`a``1` VARCHAR(4) PRIMARY KEY, `b``2` VARCHAR(3),
|
||||
`c``3` VARCHAR(7));
|
||||
@ -134,31 +134,31 @@ fo\o bar |b"a'z!
|
||||
truncate `t``1`;
|
||||
use test;
|
||||
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/f''le.txt'
|
||||
INTO TABLE `db1``; SELECT 'oops!'`.`t``1`
|
||||
INTO TABLE `db1``; select 'oops!'`.`t``1`
|
||||
FIELDS TERMINATED BY ',' ESCAPED BY '\\' ENCLOSED BY ''''
|
||||
LINES TERMINATED BY '\n'
|
||||
(`a``1`, `b``2`) SET `c``3` = concat('|', "b""a'z", "!");
|
||||
SELECT * FROM `db1``; SELECT 'oops!'`.`t``1`;
|
||||
SELECT * FROM `db1``; select 'oops!'`.`t``1`;
|
||||
a`1 b`2 c`3
|
||||
fo\o bar |b"a'z!
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `db1``; SELECT 'oops!'`; CREATE TABLE `t``1` (`a``1` VARCHAR(4) PRIMARY KEY, `b``2` VARCHAR(3),
|
||||
master-bin.000001 # Query # # use `db1``; select 'oops!'`; CREATE TABLE `t``1` (`a``1` VARCHAR(4) PRIMARY KEY, `b``2` VARCHAR(3),
|
||||
`c``3` VARCHAR(7))
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
|
||||
master-bin.000001 # Execute_load_query # # use `db1``; SELECT 'oops!'`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/f\'le.txt' INTO TABLE `t``1` FIELDS TERMINATED BY ',' ENCLOSED BY '\'' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a``1`, @`b```) SET `b``2`= @`b```, `c``3`= concat('|', "b""a'z", "!") ;file_id=#
|
||||
master-bin.000001 # Execute_load_query # # use `db1``; select 'oops!'`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/f\'le.txt' INTO TABLE `t``1` FIELDS TERMINATED BY ',' ENCLOSED BY '\'' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a``1`, @`b```) SET `b``2`= @`b```, `c``3`= concat('|', "b""a'z", "!") ;file_id=#
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `db1``; SELECT 'oops!'`; truncate `t``1`
|
||||
master-bin.000001 # Query # # use `db1``; select 'oops!'`; truncate `t``1`
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
|
||||
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/f\'le.txt' INTO TABLE `db1``; SELECT 'oops!'`.`t``1` FIELDS TERMINATED BY ',' ENCLOSED BY '\'' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a``1`, `b``2`) SET `c``3`= concat('|', "b""a'z", "!") ;file_id=#
|
||||
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/f\'le.txt' INTO TABLE `db1``; select 'oops!'`.`t``1` FIELDS TERMINATED BY ',' ENCLOSED BY '\'' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a``1`, `b``2`) SET `c``3`= concat('|', "b""a'z", "!") ;file_id=#
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
||||
DELIMITER /*!*/;
|
||||
ROLLBACK/*!*/;
|
||||
use `db1``; SELECT 'oops!'`/*!*/;
|
||||
use `db1``; select 'oops!'`/*!*/;
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
SET @@session.pseudo_thread_id=999999999/*!*/;
|
||||
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
|
||||
@ -188,7 +188,7 @@ BEGIN
|
||||
/*!*/;
|
||||
use `test`/*!*/;
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
LOAD DATA LOCAL INFILE '<name>' INTO TABLE `db1``; SELECT 'oops!'`.`t``1` FIELDS TERMINATED BY ',' ENCLOSED BY '\'' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a``1`, `b``2`) SET `c``3`= concat('|', "b""a'z", "!")
|
||||
LOAD DATA LOCAL INFILE '<name>' INTO TABLE `db1``; select 'oops!'`.`t``1` FIELDS TERMINATED BY ',' ENCLOSED BY '\'' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a``1`, `b``2`) SET `c``3`= concat('|', "b""a'z", "!")
|
||||
/*!*/;
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
COMMIT
|
||||
@ -197,10 +197,10 @@ DELIMITER ;
|
||||
# End of log file
|
||||
ROLLBACK /* added by mysqlbinlog */;
|
||||
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
||||
SELECT * FROM `db1``; SELECT 'oops!'`.`t``1`;
|
||||
SELECT * FROM `db1``; select 'oops!'`.`t``1`;
|
||||
a`1 b`2 c`3
|
||||
fo\o bar |b"a'z!
|
||||
DROP TABLE `db1``; SELECT 'oops!'`.`t``1`;
|
||||
DROP TABLE `db1``; select 'oops!'`.`t``1`;
|
||||
drop table t1,t2;
|
||||
*** Test truncation of long SET expression in LOAD DATA ***
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(1000));
|
||||
@ -223,7 +223,7 @@ a b
|
||||
2 A| 123456789A123456789B123456789C123456789D123456789E123456789F123456789G123456789H123456789I123456789J123456789K123456789L123456789M123456789N123456789O123456789P123456789Q123456789R123456789123456789T123456789U123456789V123456789W123456789X123456789Y123456789Z123456789|A
|
||||
DROP TABLE t1;
|
||||
*** Test user variables whose names require correct quoting ***
|
||||
use `db1``; SELECT 'oops!'`;
|
||||
use `db1``; select 'oops!'`;
|
||||
CREATE TABLE t1 (a1 BIGINT PRIMARY KEY, a2 BIGINT, a3 BIGINT, a4 BIGINT UNSIGNED, b DOUBLE, c DECIMAL(65,10), d VARCHAR(100));
|
||||
INSERT INTO t1 VALUES (-9223372036854775808,42,9223372036854775807,18446744073709551615,-1234560123456789e110, -1234501234567890123456789012345678901234567890123456789.0123456789, REPEAT("x", 100));
|
||||
SELECT @`a``1`:=a1, @`a``2`:=a2, @`a``3`:=a3, @`a``4`:=a4, @`b```:=b, @```c`:=c, @```d```:=d FROM t1;
|
||||
@ -232,9 +232,9 @@ SELECT @`a``1`:=a1, @`a``2`:=a2, @`a``3`:=a3, @`a``4`:=a4, @`b```:=b, @```c`:=c,
|
||||
INSERT INTO t1 VALUES (@`a``1`+1, @`a``2`*100, @`a``3`-1, @`a``4`-1, @`b```/2, @```c`, substr(@```d```, 2, 98));
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `db1``; SELECT 'oops!'`; CREATE TABLE t1 (a1 BIGINT PRIMARY KEY, a2 BIGINT, a3 BIGINT, a4 BIGINT UNSIGNED, b DOUBLE, c DECIMAL(65,10), d VARCHAR(100))
|
||||
master-bin.000001 # Query # # use `db1``; select 'oops!'`; CREATE TABLE t1 (a1 BIGINT PRIMARY KEY, a2 BIGINT, a3 BIGINT, a4 BIGINT UNSIGNED, b DOUBLE, c DECIMAL(65,10), d VARCHAR(100))
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `db1``; SELECT 'oops!'`; INSERT INTO t1 VALUES (-9223372036854775808,42,9223372036854775807,18446744073709551615,-1234560123456789e110, -1234501234567890123456789012345678901234567890123456789.0123456789, REPEAT("x", 100))
|
||||
master-bin.000001 # Query # # use `db1``; select 'oops!'`; INSERT INTO t1 VALUES (-9223372036854775808,42,9223372036854775807,18446744073709551615,-1234560123456789e110, -1234501234567890123456789012345678901234567890123456789.0123456789, REPEAT("x", 100))
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # User var # # @`a``1`=-9223372036854775808
|
||||
@ -244,13 +244,13 @@ master-bin.000001 # User var # # @`a``4`=18446744073709551615
|
||||
master-bin.000001 # User var # # @`b```=-1.234560123456789e125
|
||||
master-bin.000001 # User var # # @```c`=-1234501234567890123456789012345678901234567890123456789.0123456789
|
||||
master-bin.000001 # User var # # @```d```=_latin1 0x78787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878 COLLATE latin1_swedish_ci
|
||||
master-bin.000001 # Query # # use `db1``; SELECT 'oops!'`; INSERT INTO t1 VALUES (@`a``1`+1, @`a``2`*100, @`a``3`-1, @`a``4`-1, @`b```/2, @```c`, substr(@```d```, 2, 98))
|
||||
master-bin.000001 # Query # # use `db1``; select 'oops!'`; INSERT INTO t1 VALUES (@`a``1`+1, @`a``2`*100, @`a``3`-1, @`a``4`-1, @`b```/2, @```c`, substr(@```d```, 2, 98))
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
||||
DELIMITER /*!*/;
|
||||
ROLLBACK/*!*/;
|
||||
use `db1``; SELECT 'oops!'`/*!*/;
|
||||
use `db1``; select 'oops!'`/*!*/;
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
SET @@session.pseudo_thread_id=999999999/*!*/;
|
||||
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
|
||||
@ -291,46 +291,44 @@ DELIMITER ;
|
||||
# End of log file
|
||||
ROLLBACK /* added by mysqlbinlog */;
|
||||
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
||||
SELECT * FROM `db1``; SELECT 'oops!'`.t1 ORDER BY a1;
|
||||
SELECT * FROM `db1``; select 'oops!'`.t1 ORDER BY a1;
|
||||
a1 a2 a3 a4 b c d
|
||||
-9223372036854775808 42 9223372036854775807 18446744073709551615 -1.234560123456789e125 -1234501234567890123456789012345678901234567890123456789.0123456789 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
-9223372036854775807 4200 9223372036854775806 18446744073709551614 -6.172800617283945e124 -1234501234567890123456789012345678901234567890123456789.0123456789 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
DROP TABLE t1;
|
||||
*** Test correct quoting in foreign key error message ***
|
||||
use `db1``; SELECT 'oops!'`;
|
||||
use `db1``; select 'oops!'`;
|
||||
CREATE TABLE `t``1` ( `a``` INT PRIMARY KEY) ENGINE=innodb;
|
||||
CREATE TABLE `t``2` ( `b``` INT PRIMARY KEY, `c``` INT NOT NULL,
|
||||
FOREIGN KEY fk (`c```) REFERENCES `t``1`(`a```)) ENGINE=innodb;
|
||||
TRUNCATE `t``1`;
|
||||
ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`db1``; SELECT 'oops!'`.`t``2`, CONSTRAINT `INNODB_FOREIGN_KEY_NAME` FOREIGN KEY (`c```) REFERENCES `db1``; SELECT 'oops!'`.`t``1` (`a```))
|
||||
ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`db1``; select 'oops!'`.`t``2`, CONSTRAINT `INNODB_FOREIGN_KEY_NAME` FOREIGN KEY (`c```) REFERENCES `db1``; select 'oops!'`.`t``1` (`a```))
|
||||
DROP TABLE `t``2`;
|
||||
DROP TABLE `t``1`;
|
||||
*** Test correct quoting of DELETE FROM statement binlogged for HEAP table that is emptied due to server restart
|
||||
include/stop_slave.inc
|
||||
CREATE TABLE `db1``; SELECT 'oops!'`.`t``1` (`a``` INT PRIMARY KEY) ENGINE=heap;
|
||||
INSERT INTO `db1``; SELECT 'oops!'`.`t``1` VALUES (1), (2), (5);
|
||||
SELECT * FROM `db1``; SELECT 'oops!'`.`t``1` ORDER BY 1;
|
||||
CREATE TABLE `db1``; select 'oops!'`.`t``1` (`a``` INT PRIMARY KEY) ENGINE=heap;
|
||||
INSERT INTO `db1``; select 'oops!'`.`t``1` VALUES (1), (2), (5);
|
||||
SELECT * FROM `db1``; select 'oops!'`.`t``1` ORDER BY 1;
|
||||
a`
|
||||
1
|
||||
2
|
||||
5
|
||||
set timestamp=1000000000;
|
||||
# The table should be empty on the master.
|
||||
SELECT * FROM `db1``; SELECT 'oops!'`.`t``1`;
|
||||
SELECT * FROM `db1``; select 'oops!'`.`t``1`;
|
||||
a`
|
||||
# The DELETE statement should be correctly quoted
|
||||
show binlog events in 'master-bin.000002' from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000002 # Query # # BEGIN
|
||||
master-bin.000002 # Query # # use `test`; DELETE FROM `db1``; SELECT 'oops!'`.`t``1`
|
||||
master-bin.000002 # Query # # COMMIT
|
||||
master-bin.000002 # Query # # DELETE FROM `db1``; select 'oops!'`.`t``1`
|
||||
include/start_slave.inc
|
||||
# The table should be empty on the slave also.
|
||||
SELECT * FROM `db1``; SELECT 'oops!'`.`t``1`;
|
||||
SELECT * FROM `db1``; select 'oops!'`.`t``1`;
|
||||
a`
|
||||
DROP TABLE `db1``; SELECT 'oops!'`.`t``1`;
|
||||
DROP TABLE `db1``; select 'oops!'`.`t``1`;
|
||||
use test;
|
||||
DROP DATABASE `db1``; SELECT 'oops!'`;
|
||||
DROP DATABASE `db1``; select 'oops!'`;
|
||||
*** Test correct quoting of mysqlbinlog --rewrite-db option ***
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY);
|
||||
INSERT INTO t1 VALUES(1);
|
||||
|
@ -64,8 +64,8 @@ set sql_quote_show_create = 1;
|
||||
connection master;
|
||||
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
set sql_mode = 'ANSI_QUOTES';
|
||||
CREATE DATABASE "db1`; SELECT 'oops!'";
|
||||
use "db1`; SELECT 'oops!'";
|
||||
CREATE DATABASE "db1`; select 'oops!'";
|
||||
use "db1`; select 'oops!'";
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY) engine=MyISAM;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
set sql_mode = '';
|
||||
@ -88,7 +88,7 @@ use test;
|
||||
'fo\\o','bar'
|
||||
EOF
|
||||
|
||||
use `db1``; SELECT 'oops!'`;
|
||||
use `db1``; select 'oops!'`;
|
||||
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
set timestamp=1000000000;
|
||||
CREATE TABLE `t``1` (`a``1` VARCHAR(4) PRIMARY KEY, `b``2` VARCHAR(3),
|
||||
@ -105,11 +105,11 @@ truncate `t``1`;
|
||||
use test;
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/f''le.txt'
|
||||
INTO TABLE `db1``; SELECT 'oops!'`.`t``1`
|
||||
INTO TABLE `db1``; select 'oops!'`.`t``1`
|
||||
FIELDS TERMINATED BY ',' ESCAPED BY '\\\\' ENCLOSED BY ''''
|
||||
LINES TERMINATED BY '\\n'
|
||||
(`a``1`, `b``2`) SET `c``3` = concat('|', "b""a'z", "!");
|
||||
SELECT * FROM `db1``; SELECT 'oops!'`.`t``1`;
|
||||
SELECT * FROM `db1``; select 'oops!'`.`t``1`;
|
||||
let $pos2= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
@ -119,10 +119,10 @@ let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
SELECT * FROM `db1``; SELECT 'oops!'`.`t``1`;
|
||||
SELECT * FROM `db1``; select 'oops!'`.`t``1`;
|
||||
connection master;
|
||||
|
||||
DROP TABLE `db1``; SELECT 'oops!'`.`t``1`;
|
||||
DROP TABLE `db1``; select 'oops!'`.`t``1`;
|
||||
--remove_file $load_file
|
||||
|
||||
connection master;
|
||||
@ -158,7 +158,7 @@ DROP TABLE t1;
|
||||
|
||||
|
||||
--echo *** Test user variables whose names require correct quoting ***
|
||||
use `db1``; SELECT 'oops!'`;
|
||||
use `db1``; select 'oops!'`;
|
||||
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
CREATE TABLE t1 (a1 BIGINT PRIMARY KEY, a2 BIGINT, a3 BIGINT, a4 BIGINT UNSIGNED, b DOUBLE, c DECIMAL(65,10), d VARCHAR(100));
|
||||
INSERT INTO t1 VALUES (-9223372036854775808,42,9223372036854775807,18446744073709551615,-1234560123456789e110, -1234501234567890123456789012345678901234567890123456789.0123456789, REPEAT("x", 100));
|
||||
@ -172,13 +172,13 @@ let $pos2= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
SELECT * FROM `db1``; SELECT 'oops!'`.t1 ORDER BY a1;
|
||||
SELECT * FROM `db1``; select 'oops!'`.t1 ORDER BY a1;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo *** Test correct quoting in foreign key error message ***
|
||||
use `db1``; SELECT 'oops!'`;
|
||||
use `db1``; select 'oops!'`;
|
||||
CREATE TABLE `t``1` ( `a``` INT PRIMARY KEY) ENGINE=innodb;
|
||||
CREATE TABLE `t``2` ( `b``` INT PRIMARY KEY, `c``` INT NOT NULL,
|
||||
FOREIGN KEY fk (`c```) REFERENCES `t``1`(`a```)) ENGINE=innodb;
|
||||
@ -197,9 +197,9 @@ connection slave;
|
||||
--source include/stop_slave.inc
|
||||
|
||||
connection master;
|
||||
CREATE TABLE `db1``; SELECT 'oops!'`.`t``1` (`a``` INT PRIMARY KEY) ENGINE=heap;
|
||||
INSERT INTO `db1``; SELECT 'oops!'`.`t``1` VALUES (1), (2), (5);
|
||||
SELECT * FROM `db1``; SELECT 'oops!'`.`t``1` ORDER BY 1;
|
||||
CREATE TABLE `db1``; select 'oops!'`.`t``1` (`a``` INT PRIMARY KEY) ENGINE=heap;
|
||||
INSERT INTO `db1``; select 'oops!'`.`t``1` VALUES (1), (2), (5);
|
||||
SELECT * FROM `db1``; select 'oops!'`.`t``1` ORDER BY 1;
|
||||
|
||||
# Restart the master mysqld.
|
||||
# This will cause an implicit truncation of the memory-based table, which will
|
||||
@ -230,7 +230,7 @@ set timestamp=1000000000;
|
||||
--echo # The table should be empty on the master.
|
||||
let $binlog_file= master-bin.000002;
|
||||
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
SELECT * FROM `db1``; SELECT 'oops!'`.`t``1`;
|
||||
SELECT * FROM `db1``; select 'oops!'`.`t``1`;
|
||||
|
||||
--echo # The DELETE statement should be correctly quoted
|
||||
--source include/show_binlog_events.inc
|
||||
@ -242,16 +242,16 @@ connection master;
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
--echo # The table should be empty on the slave also.
|
||||
SELECT * FROM `db1``; SELECT 'oops!'`.`t``1`;
|
||||
SELECT * FROM `db1``; select 'oops!'`.`t``1`;
|
||||
|
||||
connection master;
|
||||
DROP TABLE `db1``; SELECT 'oops!'`.`t``1`;
|
||||
DROP TABLE `db1``; select 'oops!'`.`t``1`;
|
||||
sync_slave_with_master;
|
||||
|
||||
|
||||
connection master;
|
||||
use test;
|
||||
DROP DATABASE `db1``; SELECT 'oops!'`;
|
||||
DROP DATABASE `db1``; select 'oops!'`;
|
||||
|
||||
--echo *** Test correct quoting of mysqlbinlog --rewrite-db option ***
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY);
|
||||
|
@ -21,6 +21,16 @@
|
||||
connection slave;
|
||||
--let $connection_id=`SELECT id FROM information_schema.processlist where state LIKE 'Waiting for master to send event'`
|
||||
|
||||
if(!$connection_id)
|
||||
{
|
||||
# Something went wrong (timing)
|
||||
# Show process list so that we can debug. In this case we will abort with
|
||||
# wrong result
|
||||
-- echo "Could not find connect id. Dumping process list for debugging"
|
||||
SELECT * FROM information_schema.processlist;
|
||||
exit;
|
||||
}
|
||||
|
||||
set @time_before_kill := (select CURRENT_TIMESTAMP);
|
||||
|
||||
--echo [Time before the query]
|
||||
|
@ -10,6 +10,5 @@ there should be *no* long test name listed below:
|
||||
select distinct variable_name as `there should be *no* variables listed below:` from t2
|
||||
left join t1 on variable_name=test_name where test_name is null;
|
||||
there should be *no* variables listed below:
|
||||
expensive_subquery_limit
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
|
@ -0,0 +1,52 @@
|
||||
SET @start_global_value = @@global.expensive_subquery_limit;
|
||||
SELECT @start_global_value;
|
||||
@start_global_value
|
||||
100
|
||||
select @@global.expensive_subquery_limit;
|
||||
@@global.expensive_subquery_limit
|
||||
100
|
||||
select @@session.expensive_subquery_limit;
|
||||
@@session.expensive_subquery_limit
|
||||
100
|
||||
show global variables like 'expensive_subquery_limit';
|
||||
Variable_name Value
|
||||
expensive_subquery_limit 100
|
||||
show session variables like 'expensive_subquery_limit';
|
||||
Variable_name Value
|
||||
expensive_subquery_limit 100
|
||||
select * from information_schema.global_variables where variable_name='expensive_subquery_limit';
|
||||
VARIABLE_NAME VARIABLE_VALUE
|
||||
EXPENSIVE_SUBQUERY_LIMIT 100
|
||||
select * from information_schema.session_variables where variable_name='expensive_subquery_limit';
|
||||
VARIABLE_NAME VARIABLE_VALUE
|
||||
EXPENSIVE_SUBQUERY_LIMIT 100
|
||||
set global expensive_subquery_limit=10;
|
||||
set session expensive_subquery_limit=20;
|
||||
select @@global.expensive_subquery_limit;
|
||||
@@global.expensive_subquery_limit
|
||||
10
|
||||
select @@session.expensive_subquery_limit;
|
||||
@@session.expensive_subquery_limit
|
||||
20
|
||||
show global variables like 'expensive_subquery_limit';
|
||||
Variable_name Value
|
||||
expensive_subquery_limit 10
|
||||
show session variables like 'expensive_subquery_limit';
|
||||
Variable_name Value
|
||||
expensive_subquery_limit 20
|
||||
select * from information_schema.global_variables where variable_name='expensive_subquery_limit';
|
||||
VARIABLE_NAME VARIABLE_VALUE
|
||||
EXPENSIVE_SUBQUERY_LIMIT 10
|
||||
select * from information_schema.session_variables where variable_name='expensive_subquery_limit';
|
||||
VARIABLE_NAME VARIABLE_VALUE
|
||||
EXPENSIVE_SUBQUERY_LIMIT 20
|
||||
set global expensive_subquery_limit=1.1;
|
||||
ERROR 42000: Incorrect argument type to variable 'expensive_subquery_limit'
|
||||
set global expensive_subquery_limit=1e1;
|
||||
ERROR 42000: Incorrect argument type to variable 'expensive_subquery_limit'
|
||||
set global expensive_subquery_limit="foo";
|
||||
ERROR 42000: Incorrect argument type to variable 'expensive_subquery_limit'
|
||||
SET @@global.expensive_subquery_limit = @start_global_value;
|
||||
SELECT @@global.expensive_subquery_limit;
|
||||
@@global.expensive_subquery_limit
|
||||
100
|
@ -0,0 +1,24 @@
|
||||
SELECT @@global.innodb_merge_sort_block_size;
|
||||
@@global.innodb_merge_sort_block_size
|
||||
1048576
|
||||
SELECT @@session.innodb_merge_sort_block_size;
|
||||
@@session.innodb_merge_sort_block_size
|
||||
1048576
|
||||
SET @old_global=@@global.innodb_merge_sort_block_size;
|
||||
SET @old_session=@@session.innodb_merge_sort_block_size;
|
||||
SET @@global.innodb_merge_sort_block_size = 2*1024*1024;
|
||||
SET @@session.innodb_merge_sort_block_size = 4*1024*1024;
|
||||
SELECT @@global.innodb_merge_sort_block_size;
|
||||
@@global.innodb_merge_sort_block_size
|
||||
2097152
|
||||
SELECT @@session.innodb_merge_sort_block_size;
|
||||
@@session.innodb_merge_sort_block_size
|
||||
4194304
|
||||
SET @@global.innodb_merge_sort_block_size = 1024*1024*1024+1;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect innodb_merge_sort_block_size value: '1073741825'
|
||||
SELECT @@global.innodb_merge_sort_block_size;
|
||||
@@global.innodb_merge_sort_block_size
|
||||
1073741824
|
||||
SET @@global.innodb_merge_sort_block_size=@old_global;
|
||||
SET @@session.innodb_merge_sort_block_size=@old_session;
|
@ -0,0 +1,38 @@
|
||||
SET @start_global_value = @@global.expensive_subquery_limit;
|
||||
SELECT @start_global_value;
|
||||
|
||||
#
|
||||
# exists as global and session
|
||||
#
|
||||
select @@global.expensive_subquery_limit;
|
||||
select @@session.expensive_subquery_limit;
|
||||
show global variables like 'expensive_subquery_limit';
|
||||
show session variables like 'expensive_subquery_limit';
|
||||
select * from information_schema.global_variables where variable_name='expensive_subquery_limit';
|
||||
select * from information_schema.session_variables where variable_name='expensive_subquery_limit';
|
||||
|
||||
#
|
||||
# show that it's writable
|
||||
#
|
||||
set global expensive_subquery_limit=10;
|
||||
set session expensive_subquery_limit=20;
|
||||
select @@global.expensive_subquery_limit;
|
||||
select @@session.expensive_subquery_limit;
|
||||
show global variables like 'expensive_subquery_limit';
|
||||
show session variables like 'expensive_subquery_limit';
|
||||
select * from information_schema.global_variables where variable_name='expensive_subquery_limit';
|
||||
select * from information_schema.session_variables where variable_name='expensive_subquery_limit';
|
||||
|
||||
#
|
||||
# incorrect types
|
||||
#
|
||||
--error ER_WRONG_TYPE_FOR_VAR
|
||||
set global expensive_subquery_limit=1.1;
|
||||
--error ER_WRONG_TYPE_FOR_VAR
|
||||
set global expensive_subquery_limit=1e1;
|
||||
--error ER_WRONG_TYPE_FOR_VAR
|
||||
set global expensive_subquery_limit="foo";
|
||||
|
||||
SET @@global.expensive_subquery_limit = @start_global_value;
|
||||
SELECT @@global.expensive_subquery_limit;
|
||||
|
@ -0,0 +1,19 @@
|
||||
--source include/have_xtradb.inc
|
||||
|
||||
SELECT @@global.innodb_merge_sort_block_size;
|
||||
SELECT @@session.innodb_merge_sort_block_size;
|
||||
|
||||
SET @old_global=@@global.innodb_merge_sort_block_size;
|
||||
SET @old_session=@@session.innodb_merge_sort_block_size;
|
||||
|
||||
SET @@global.innodb_merge_sort_block_size = 2*1024*1024;
|
||||
SET @@session.innodb_merge_sort_block_size = 4*1024*1024;
|
||||
|
||||
SELECT @@global.innodb_merge_sort_block_size;
|
||||
SELECT @@session.innodb_merge_sort_block_size;
|
||||
|
||||
SET @@global.innodb_merge_sort_block_size = 1024*1024*1024+1;
|
||||
SELECT @@global.innodb_merge_sort_block_size;
|
||||
|
||||
SET @@global.innodb_merge_sort_block_size=@old_global;
|
||||
SET @@session.innodb_merge_sort_block_size=@old_session;
|
9
mysql-test/t/adddate_454.test
Normal file
9
mysql-test/t/adddate_454.test
Normal file
@ -0,0 +1,9 @@
|
||||
#
|
||||
# MDEV-454 Addition of a time interval reduces the resulting value
|
||||
#
|
||||
create table t1 (d date);
|
||||
insert into t1 values ('2012-00-00');
|
||||
select * from t1;
|
||||
update t1 set d = adddate(d, interval 1 day);
|
||||
select * from t1;
|
||||
drop table t1;
|
@ -104,7 +104,7 @@ explain extended select last_insert_id();
|
||||
--error ER_DUP_ENTRY
|
||||
insert into t1 set i = 254;
|
||||
select last_insert_id();
|
||||
--error ER_DUP_ENTRY
|
||||
--error 167
|
||||
insert into t1 set i = null;
|
||||
select last_insert_id();
|
||||
drop table t1;
|
||||
@ -113,6 +113,7 @@ create table t1 (i tinyint unsigned not null auto_increment, key (i));
|
||||
insert into t1 set i = 254;
|
||||
insert into t1 set i = null;
|
||||
select last_insert_id();
|
||||
--error 167
|
||||
insert into t1 set i = null;
|
||||
select last_insert_id();
|
||||
drop table t1;
|
||||
@ -353,7 +354,7 @@ INSERT INTO t1 VALUES (18446744073709551601);
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=10;
|
||||
|
||||
SELECT @@SESSION.AUTO_INCREMENT_OFFSET;
|
||||
--error ER_WARN_DATA_OUT_OF_RANGE
|
||||
--error 167
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
SELECT * FROM t1;
|
||||
|
||||
|
240
mysql-test/t/auto_increment_ranges.inc
Normal file
240
mysql-test/t/auto_increment_ranges.inc
Normal file
@ -0,0 +1,240 @@
|
||||
#
|
||||
# Test of auto_increment at end of range
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
--echo #
|
||||
--echo # Testing ranges with smallint
|
||||
--echo #
|
||||
let $type=smallint;
|
||||
let $range_max=32767;
|
||||
|
||||
eval create table t1 (a $type primary key auto_increment);
|
||||
eval insert into t1 values($range_max);
|
||||
--error 167
|
||||
insert into t1 values(NULL);
|
||||
truncate table t1;
|
||||
eval insert into t1 values($range_max-1);
|
||||
insert into t1 values(NULL);
|
||||
--error 167
|
||||
insert into t1 values(NULL);
|
||||
select * from t1;
|
||||
truncate table t1;
|
||||
--error 167
|
||||
eval insert into t1 values($range_max),(NULL);
|
||||
select * from t1;
|
||||
truncate table t1;
|
||||
--error 167
|
||||
eval insert into t1 values($range_max-1),(NULL),(NULL);
|
||||
truncate table t1;
|
||||
eval insert into t1 values($range_max+1);
|
||||
select * from t1;
|
||||
--error 167
|
||||
eval insert into t1 values(NULL);
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # Testing ranges with unsigned smallint
|
||||
--echo #
|
||||
|
||||
let $type=smallint unsigned;
|
||||
let $range_max=65535;
|
||||
|
||||
eval create table t1 (a $type primary key auto_increment);
|
||||
eval insert into t1 values($range_max);
|
||||
--error 167
|
||||
insert into t1 values(NULL);
|
||||
truncate table t1;
|
||||
eval insert into t1 values($range_max-1);
|
||||
insert into t1 values(NULL);
|
||||
--error 167
|
||||
insert into t1 values(NULL);
|
||||
select * from t1;
|
||||
truncate table t1;
|
||||
--error 167
|
||||
eval insert into t1 values($range_max),(NULL);
|
||||
select * from t1;
|
||||
truncate table t1;
|
||||
--error 167
|
||||
eval insert into t1 values($range_max-1),(NULL),(NULL);
|
||||
truncate table t1;
|
||||
eval insert into t1 values($range_max+1);
|
||||
select * from t1;
|
||||
--error 167
|
||||
eval insert into t1 values(NULL);
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # Testing ranges with integer
|
||||
--echo #
|
||||
|
||||
let $type=int;
|
||||
let $range_max=2147483647;
|
||||
|
||||
eval create table t1 (a $type primary key auto_increment);
|
||||
eval insert into t1 values($range_max);
|
||||
--error 167
|
||||
insert into t1 values(NULL);
|
||||
truncate table t1;
|
||||
eval insert into t1 values($range_max-1);
|
||||
insert into t1 values(NULL);
|
||||
--error 167
|
||||
insert into t1 values(NULL);
|
||||
select * from t1;
|
||||
truncate table t1;
|
||||
--error 167
|
||||
eval insert into t1 values($range_max),(NULL);
|
||||
select * from t1;
|
||||
truncate table t1;
|
||||
--error 167
|
||||
eval insert into t1 values($range_max-1),(NULL),(NULL);
|
||||
truncate table t1;
|
||||
eval insert into t1 values($range_max+1);
|
||||
select * from t1;
|
||||
--error 167
|
||||
eval insert into t1 values(NULL);
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # Testing ranges with unsigned integer
|
||||
--echo #
|
||||
|
||||
let $type=int unsigned;
|
||||
let $range_max=4294967295;
|
||||
|
||||
eval create table t1 (a $type primary key auto_increment);
|
||||
eval insert into t1 values($range_max);
|
||||
--error 167
|
||||
insert into t1 values(NULL);
|
||||
truncate table t1;
|
||||
eval insert into t1 values($range_max-1);
|
||||
insert into t1 values(NULL);
|
||||
--error 167
|
||||
insert into t1 values(NULL);
|
||||
select * from t1;
|
||||
truncate table t1;
|
||||
--error 167
|
||||
eval insert into t1 values($range_max),(NULL);
|
||||
select * from t1;
|
||||
truncate table t1;
|
||||
--error 167
|
||||
eval insert into t1 values($range_max-1),(NULL),(NULL);
|
||||
truncate table t1;
|
||||
eval insert into t1 values($range_max+1);
|
||||
select * from t1;
|
||||
--error 167
|
||||
eval insert into t1 values(NULL);
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # Testing ranges with bigint
|
||||
--echo #
|
||||
|
||||
let $type=bigint;
|
||||
let $range_max=cast(9223372036854775807 as unsigned);
|
||||
|
||||
eval create table t1 (a $type primary key auto_increment);
|
||||
eval insert into t1 values($range_max);
|
||||
--error 167
|
||||
insert into t1 values(NULL);
|
||||
truncate table t1;
|
||||
eval insert into t1 values($range_max-1);
|
||||
insert into t1 values(NULL);
|
||||
--error 167
|
||||
insert into t1 values(NULL);
|
||||
select * from t1;
|
||||
truncate table t1;
|
||||
--error 167
|
||||
eval insert into t1 values($range_max),(NULL);
|
||||
select * from t1;
|
||||
truncate table t1;
|
||||
--error 167
|
||||
eval insert into t1 values($range_max-1),(NULL),(NULL);
|
||||
truncate table t1;
|
||||
eval insert into t1 values($range_max+1);
|
||||
select * from t1;
|
||||
--error 167
|
||||
eval insert into t1 values(NULL);
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # Testing ranges with unsigned bigint
|
||||
--echo #
|
||||
|
||||
let $type=bigint unsigned;
|
||||
let $range_max=18446744073709551615;
|
||||
|
||||
eval create table t1 (a $type primary key auto_increment);
|
||||
eval insert into t1 values($range_max-1);
|
||||
--error ER_AUTOINC_READ_FAILED
|
||||
insert into t1 values(NULL);
|
||||
--error ER_AUTOINC_READ_FAILED
|
||||
insert into t1 values(NULL);
|
||||
truncate table t1;
|
||||
eval insert into t1 values($range_max-1);
|
||||
--error ER_AUTOINC_READ_FAILED
|
||||
insert into t1 values(NULL);
|
||||
--error ER_AUTOINC_READ_FAILED
|
||||
insert into t1 values(NULL);
|
||||
select * from t1;
|
||||
truncate table t1;
|
||||
--error ER_AUTOINC_READ_FAILED
|
||||
eval insert into t1 values($range_max),(NULL);
|
||||
select * from t1;
|
||||
truncate table t1;
|
||||
--error ER_AUTOINC_READ_FAILED
|
||||
eval insert into t1 values($range_max-1),(NULL),(NULL);
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # Test IGNORE and strict mode
|
||||
--echo #
|
||||
create table t1 (a smallint primary key auto_increment);
|
||||
insert ignore into t1 values(32766),(NULL),(NULL),(1);
|
||||
select * from t1;
|
||||
truncate table t1;
|
||||
|
||||
set @org_mode=@@sql_mode;
|
||||
set @@sql_mode='ansi,traditional';
|
||||
insert ignore into t1 values(32766),(NULL),(NULL);
|
||||
truncate table t1;
|
||||
--error 167
|
||||
insert into t1 values(32766),(NULL),(NULL);
|
||||
set @@sql_mode=@org_mode;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # Test auto increment with negative numbers
|
||||
--echo #
|
||||
CREATE TABLE t1 (a INTEGER AUTO_INCREMENT, PRIMARY KEY (a));
|
||||
INSERT INTO t1 VALUES (NULL), (2), (-5), (NULL);
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1;
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (-5), (NULL);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Test inserting a value out-of-range into an auto increment column
|
||||
--echo #
|
||||
CREATE TABLE t1 (a smallint AUTO_INCREMENT, PRIMARY KEY (a));
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t1 VALUES (32768);
|
||||
--error 167
|
||||
INSERT INTO t1 VALUES (NULL);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Test old behaviour
|
||||
--echo #
|
||||
create table t1 (a smallint primary key auto_increment);
|
||||
insert into t1 values(32766),(NULL);
|
||||
delete from t1 where a=32767;
|
||||
--error 167
|
||||
insert into t1 values(NULL);
|
||||
drop table t1;
|
7
mysql-test/t/auto_increment_ranges_innodb.test
Normal file
7
mysql-test/t/auto_increment_ranges_innodb.test
Normal file
@ -0,0 +1,7 @@
|
||||
#
|
||||
# Test of auto_increment at end of range
|
||||
#
|
||||
|
||||
--source include/have_innodb.inc
|
||||
set default_storage_engine=innodb;
|
||||
--source auto_increment_ranges.inc
|
7
mysql-test/t/auto_increment_ranges_myisam.test
Normal file
7
mysql-test/t/auto_increment_ranges_myisam.test
Normal file
@ -0,0 +1,7 @@
|
||||
#
|
||||
# Test of auto_increment at end of range
|
||||
#
|
||||
|
||||
set default_storage_engine=MYISAM;
|
||||
--source auto_increment_ranges.inc
|
||||
|
8
mysql-test/t/datetime_456.test
Normal file
8
mysql-test/t/datetime_456.test
Normal file
@ -0,0 +1,8 @@
|
||||
#
|
||||
# MDEV-456 An out-of-range datetime value (with a 5-digit year) can be created and cause troubles
|
||||
#
|
||||
create table t1 (d datetime);
|
||||
insert t1 values (addtime('9999-12-31 23:59:59', '00:00:01')),
|
||||
(from_days(3652499));
|
||||
select * from t1;
|
||||
drop table t1;
|
@ -189,3 +189,12 @@ INSERT INTO t2 VALUES (1,0) ON DUPLICATE KEY UPDATE
|
||||
INSERT INTO t2(a,b) VALUES (1,0) ON DUPLICATE KEY UPDATE
|
||||
b=(SELECT VALUES(a)+2 FROM t1);
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-492: incorrect error check before sending OK in mysql_update
|
||||
--echo #
|
||||
CREATE TABLE t1 (a CHAR(3), b BLOB);
|
||||
--error ER_DYN_COL_DATA
|
||||
UPDATE t1 SET a = 'new'
|
||||
WHERE COLUMN_CREATE( 1, 'v', 1, 'w' ) IS NULL;
|
||||
drop table t1;
|
||||
|
111
mysql-test/t/features.test
Normal file
111
mysql-test/t/features.test
Normal file
@ -0,0 +1,111 @@
|
||||
# Testing of feature statistics
|
||||
|
||||
-- source include/have_geometry.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
show status like "feature%";
|
||||
|
||||
--echo #
|
||||
--echo # Feature GIS
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (g POINT);
|
||||
SHOW FIELDS FROM t1;
|
||||
INSERT INTO t1 VALUES
|
||||
(PointFromText('POINT(10 10)')),
|
||||
(PointFromText('POINT(20 10)')),
|
||||
(PointFromText('POINT(20 20)')),
|
||||
(PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
|
||||
drop table t1;
|
||||
|
||||
show status like "feature_gis";
|
||||
|
||||
--echo #
|
||||
--echo # Feature dynamic columns
|
||||
--echo #
|
||||
set @a= COLUMN_CREATE(1, 1212 AS int);
|
||||
set @b= column_add(@a, 2, 1212 as integer);
|
||||
select column_get(@b, 2 as integer);
|
||||
|
||||
show status like "feature_dynamic_columns";
|
||||
|
||||
--echo #
|
||||
--echo # Feature fulltext
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)) engine=myisam;
|
||||
INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
|
||||
('Full-text indexes', 'are called collections'),
|
||||
('Only MyISAM tables','support collections'),
|
||||
('Function MATCH ... AGAINST()','is used to do a search'),
|
||||
('Full-text search in MySQL', 'implements vector space model');
|
||||
select * from t1 where MATCH(a,b) AGAINST ("collections");
|
||||
select * from t1 where MATCH(a,b) AGAINST ("indexes");
|
||||
drop table t1;
|
||||
|
||||
# We need the following when running with --ps-protocol
|
||||
--replace_result 4 2
|
||||
show status like "feature_fulltext";
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Feature locale
|
||||
--echo #
|
||||
|
||||
SET lc_messages=sr_RS;
|
||||
SET lc_messages=en_US;
|
||||
show status like "feature_locale";
|
||||
|
||||
--echo #
|
||||
--echo # Feature subquery
|
||||
--echo #
|
||||
|
||||
select (select 2);
|
||||
SELECT (SELECT 1) UNION SELECT (SELECT 2);
|
||||
|
||||
create table t1 (a int);
|
||||
insert into t1 values (2);
|
||||
select (select a from t1 where t1.a=t2.a), a from t1 as t2;
|
||||
drop table t1;
|
||||
--replace_result 8 4
|
||||
show status like "feature_subquery";
|
||||
|
||||
--echo #
|
||||
--echo # Feature timezone
|
||||
--echo #
|
||||
|
||||
SELECT FROM_UNIXTIME(unix_timestamp()) > "1970-01-01";
|
||||
set time_zone="+03:00";
|
||||
SELECT FROM_UNIXTIME(unix_timestamp()) > "1970-01-01";
|
||||
set time_zone= @@global.time_zone;
|
||||
show status like "feature_timezone";
|
||||
|
||||
--echo #
|
||||
--echo # Feature triggers
|
||||
--echo #
|
||||
|
||||
create table t1 (i int);
|
||||
--echo # let us test some very simple trigger
|
||||
create trigger trg before insert on t1 for each row set @a:=1;
|
||||
set @a:=0;
|
||||
select @a;
|
||||
insert into t1 values (1),(2);
|
||||
select @a;
|
||||
SHOW TRIGGERS IN test like 't1';
|
||||
drop trigger trg;
|
||||
drop table t1;
|
||||
|
||||
show status like "%trigger%";
|
||||
|
||||
--echo #
|
||||
--echo # Feature xml
|
||||
--echo #
|
||||
SET @xml='<a aa1="aa1" aa2="aa2">a1<b ba1="ba1">b1<c>c1</c>b2</b>a2</a>';
|
||||
SELECT extractValue(@xml,'/a');
|
||||
select updatexml('<div><div><span>1</span><span>2</span></div></div>',
|
||||
'/','<tr><td>1</td><td>2</td></tr>') as upd1;
|
||||
--replace_result 4 2
|
||||
show status like "feature_xml";
|
@ -1172,3 +1172,5 @@ select cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetim
|
||||
|
||||
select microsecond('12:00:00.123456'), microsecond('2009-12-31 23:59:59.000010');
|
||||
|
||||
--error ER_TOO_BIG_PRECISION
|
||||
select now(258);
|
||||
|
@ -1293,6 +1293,21 @@ WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
|
||||
#WHERE lakes.name = 'Blue Lake';
|
||||
|
||||
DROP DATABASE gis_ogs;
|
||||
|
||||
--echo #
|
||||
--echo # BUG #1043845 st_distance() results are incorrect depending on variable order
|
||||
--echo #
|
||||
|
||||
select st_distance(geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
|
||||
-95.9673057475387 36.1344478941074,
|
||||
-95.9673063519371 36.134484524621,
|
||||
-95.9673049102515 36.1343976584193)'),
|
||||
geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)')) ;
|
||||
select st_distance(geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)'),
|
||||
geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
|
||||
-95.9673057475387 36.1344478941074,
|
||||
-95.9673063519371 36.134484524621,
|
||||
-95.9673049102515 36.1343976584193) ')) ;
|
||||
USE test;
|
||||
|
||||
|
||||
@ -1344,4 +1359,3 @@ SELECT 1 FROM g1 WHERE a >= ANY
|
||||
DROP TABLE g1;
|
||||
|
||||
--echo End of 5.5 tests
|
||||
|
||||
|
46
mysql-test/t/last_value.test
Normal file
46
mysql-test/t/last_value.test
Normal file
@ -0,0 +1,46 @@
|
||||
#
|
||||
# Tests for the LAST_VALUE function
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop database if exists mysqltest;
|
||||
--enable_warnings
|
||||
|
||||
# CREATE TABLE `queue` (
|
||||
# `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
# `priority` int(11) DEFAULT NULL,
|
||||
# `state` int(11) DEFAULT NULL,
|
||||
# `pid` int(10) unsigned DEFAULT NULL,
|
||||
# `dat` varbinary(200) DEFAULT NULL,
|
||||
# PRIMARY KEY (`id`)
|
||||
# )
|
||||
|
||||
CREATE TABLE t1 (a INT, b INT, c INT, d INT);
|
||||
INSERT INTO t1 VALUES (1,3,0,NULL),(2,2,0,NULL),(3,4,0,NULL),(4,2,0,NULL);
|
||||
SELECT * FROM t1;
|
||||
UPDATE t1 SET c=LAST_VALUE(@last_a:=a,@last_b:=b,@last_c:=c,1), d=4211 WHERE c=0 ORDER BY b DESC LIMIT 1;
|
||||
SELECT @last_a, @last_b, @last_c;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Test with different types
|
||||
#
|
||||
# PS protocol gives slightly different metadata for the length
|
||||
--enable_metadata
|
||||
--disable_ps_protocol
|
||||
SELECT LAST_VALUE(@last_a:=1,@last_b:=1);
|
||||
select @last_b;
|
||||
--enable_ps_protocol
|
||||
SELECT LAST_VALUE(@last_a:=1,@last_b:=1.0);
|
||||
select @last_b;
|
||||
SELECT LAST_VALUE(@last_a:=1,@last_b:="hello");
|
||||
select @last_b;
|
||||
SELECT date(LAST_VALUE(@last_a:=1,@last_b:="2001-02-03"));
|
||||
select @last_b;
|
||||
SELECT LAST_VALUE(@last_a:=1,@last_b:="2001-02-03",NULL);
|
||||
select @last_b;
|
||||
--disable_metadata
|
||||
--error ER_PARSE_ERROR
|
||||
SELECT LAST_VALUE();
|
@ -1,6 +1,8 @@
|
||||
#
|
||||
# MDEV-375 Server crashes in THD::print_aborted_warning with log_warnings > 3
|
||||
#
|
||||
--source include/not_embedded.inc
|
||||
|
||||
SET GLOBAL log_warnings=4;
|
||||
SET GLOBAL max_connections=2;
|
||||
|
||||
|
@ -25,9 +25,9 @@ drop table t1;
|
||||
|
||||
create table t1 (a tinyint not null auto_increment primary key, b char(20) default "default_value");
|
||||
insert into t1 values (126,"first"),(63, "middle"),(0,"last");
|
||||
--error ER_DUP_ENTRY
|
||||
--error 167
|
||||
insert into t1 values (0,"error");
|
||||
--error ER_DUP_ENTRY
|
||||
--error 167
|
||||
replace into t1 values (0,"error");
|
||||
replace into t1 values (126,"first updated");
|
||||
replace into t1 values (63,default);
|
||||
|
@ -184,6 +184,75 @@ INSERT INTO t VALUES (''),(''),(''),(''),(''),(''),(''),(''),(''),(''),('');
|
||||
SELECT * FROM (SELECT default(a) FROM t GROUP BY a) d;
|
||||
DROP TABLE t;
|
||||
|
||||
--echo #
|
||||
--echo # LP BUG#1009187, MDEV-373, MYSQL bug#58628
|
||||
--echo # Wrong result for a query with [NOT] IN subquery predicate if
|
||||
--echo # the left part of the predicate is explicit NULL
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (pk INT NOT NULL, i INT NOT NULL);
|
||||
INSERT INTO t1 VALUES (0,10), (1,20), (2,30), (3,40);
|
||||
|
||||
CREATE TABLE t2a (pk INT NOT NULL, i INT NOT NULL, PRIMARY KEY(i,pk));
|
||||
INSERT INTO t2a VALUES (0,0), (1,1), (2,2), (3,3);
|
||||
|
||||
CREATE TABLE t2b (pk INT, i INT);
|
||||
INSERT INTO t2b VALUES (0,0), (1,1), (2,2), (3,3);
|
||||
|
||||
CREATE TABLE t2c (pk INT NOT NULL, i INT NOT NULL);
|
||||
INSERT INTO t2c VALUES (0,0), (1,1), (2,2), (3,3);
|
||||
create index it2c on t2c (i,pk);
|
||||
|
||||
CREATE TABLE t2d (pk INT NOT NULL, i INT NOT NULL, PRIMARY KEY(i));
|
||||
INSERT INTO t2d VALUES (0,0), (1,1), (2,2), (3,3);
|
||||
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk);
|
||||
SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk);
|
||||
SELECT * FROM t1 WHERE 1+NULL NOT IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk);
|
||||
SELECT * FROM t1 WHERE NULL IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk) IS UNKNOWN;
|
||||
SELECT t1.pk, NULL NOT IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk) FROM t1;
|
||||
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2b.i FROM t2b WHERE t2b.pk = t1.pk);
|
||||
SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2b.i FROM t2b WHERE t2b.pk = t1.pk);
|
||||
SELECT * FROM t1 WHERE NULL IN (SELECT t2b.i FROM t2b WHERE t2b.pk = t1.pk) IS UNKNOWN;
|
||||
SELECT t1.pk, NULL NOT IN (SELECT t2b.i FROM t2b WHERE t2b.pk = t1.pk) FROM t1;
|
||||
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2c.i FROM t2c WHERE t2c.pk = t1.pk);
|
||||
SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2c.i FROM t2c WHERE t2c.pk = t1.pk);
|
||||
SELECT * FROM t1 WHERE NULL IN (SELECT t2c.i FROM t2c WHERE t2c.pk = t1.pk) IS UNKNOWN;
|
||||
SELECT t1.pk, NULL NOT IN (SELECT t2c.i FROM t2c WHERE t2c.pk = t1.pk) FROM t1;
|
||||
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2d.i FROM t2d WHERE t2d.pk = t1.pk);
|
||||
SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2d.i FROM t2d WHERE t2d.pk = t1.pk);
|
||||
SELECT * FROM t1 WHERE NULL IN (SELECT t2d.i FROM t2d WHERE t2d.pk = t1.pk) IS UNKNOWN;
|
||||
SELECT t1.pk, NULL NOT IN (SELECT t2d.i FROM t2d WHERE t2d.pk = t1.pk) FROM t1;
|
||||
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2a.i, t2a.pk FROM t2a WHERE t2a.pk = t1.pk);
|
||||
SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2a.i, t2a.pk FROM t2a WHERE t2a.pk = t1.pk);
|
||||
SELECT (NULL, 1) NOT IN (SELECT t2a.i, t2a.pk FROM t2a WHERE t2a.pk = t1.pk) from t1;
|
||||
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2b.i, t2b.pk FROM t2b WHERE t2b.pk = t1.pk);
|
||||
SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2b.i, t2b.pk FROM t2b WHERE t2b.pk = t1.pk);
|
||||
SELECT (NULL, 1) NOT IN (SELECT t2b.i, t2b.pk FROM t2b WHERE t2b.pk = t1.pk) from t1;
|
||||
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2c.i, t2c.pk FROM t2c WHERE t2c.pk = t1.pk);
|
||||
SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2c.i, t2c.pk FROM t2c WHERE t2c.pk = t1.pk);
|
||||
SELECT (NULL, 1) NOT IN (SELECT t2c.i, t2c.pk FROM t2c WHERE t2c.pk = t1.pk) from t1;
|
||||
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2d.i, t2d.pk FROM t2d WHERE t2d.pk = t1.pk);
|
||||
SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2d.i, t2d.pk FROM t2d WHERE t2d.pk = t1.pk);
|
||||
SELECT (NULL, 1) NOT IN (SELECT t2d.i, t2d.pk FROM t2d WHERE t2d.pk = t1.pk) from t1;
|
||||
|
||||
drop table t1, t2a, t2b, t2c, t2d;
|
||||
|
||||
--echo #
|
||||
--echo # End of 5.1 tests.
|
||||
--echo #
|
||||
|
@ -4618,6 +4618,8 @@ DROP TABLE t1,t2,t3;
|
||||
--echo # inserting into a view over a view
|
||||
--echo #
|
||||
|
||||
flush status;
|
||||
--disable_ps_protocol
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE ALGORITHM=MERGE VIEW v1 AS SELECT a1.* FROM t1 AS a1, t1 AS a2;
|
||||
CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM v1;
|
||||
@ -4625,7 +4627,40 @@ INSERT INTO v2 (a) VALUES (1) ;
|
||||
select * from t1;
|
||||
drop view v2,v1;
|
||||
drop table t1;
|
||||
show status like '%view%';
|
||||
show status like 'Opened_table%';
|
||||
--enable_ps_protocol
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-486 LP BUG#1010116 Incorrect query results in
|
||||
--echo # view and derived tables
|
||||
--echo #
|
||||
|
||||
SELECT
|
||||
`Derived1`.`id`,
|
||||
`Derived2`.`Val1`
|
||||
FROM (select 30631 as `id`) AS `Derived1` LEFT OUTER JOIN (SELECT
|
||||
2 as `id`,
|
||||
1 AS `Val1`
|
||||
FROM (select 30631 as `id`) AS `Derived3`) AS `Derived2` ON `Derived1`.`id` = `Derived2`.`id`;
|
||||
|
||||
create table t1 ( id int );
|
||||
insert into t1 values (30631);
|
||||
create table t2 ( id int );
|
||||
insert into t2 values (30631);
|
||||
create algorithm=MERGE view v2 as select 2 as id, 1 as val1 from t2;
|
||||
select t1.*, v2.* from t1 left join v2 on t1.id = v2.id;
|
||||
drop view v2;
|
||||
drop table t1,t2;
|
||||
|
||||
create table t1 ( id int );
|
||||
insert into t1 values (30631);
|
||||
create table t2 ( id int );
|
||||
insert into t2 values (30631);
|
||||
create algorithm=MERGE view v2 as select 2 as id, id is null as bbb, id as iddqd, 1 as val1 from t2;
|
||||
select t1.*, v2.* from t1 left join v2 on t1.id = v2.id;
|
||||
drop view v2;
|
||||
drop table t1,t2;
|
||||
--echo # -----------------------------------------------------------------
|
||||
--echo # -- End of 5.3 tests.
|
||||
--echo # -----------------------------------------------------------------
|
||||
|
@ -271,7 +271,7 @@ static int ptr_cmp(void **a, void **b)
|
||||
void _lf_pinbox_free(LF_PINS *pins, void *addr)
|
||||
{
|
||||
add_to_purgatory(pins, addr);
|
||||
if (pins->purgatory_count % LF_PURGATORY_SIZE)
|
||||
if (pins->purgatory_count % LF_PURGATORY_SIZE == 0)
|
||||
_lf_pinbox_real_free(pins);
|
||||
}
|
||||
|
||||
|
@ -268,8 +268,10 @@ static LF_SLIST *lsearch(LF_SLIST * volatile *head, CHARSET_INFO *cs,
|
||||
int res= lfind(head, cs, hashnr, key, keylen, &cursor, pins);
|
||||
if (res)
|
||||
_lf_pin(pins, 2, cursor.curr);
|
||||
_lf_unpin(pins, 0);
|
||||
else
|
||||
_lf_unpin(pins, 2);
|
||||
_lf_unpin(pins, 1);
|
||||
_lf_unpin(pins, 0);
|
||||
return res ? cursor.curr : 0;
|
||||
}
|
||||
|
||||
|
@ -440,7 +440,7 @@ process_flags:
|
||||
/* TODO: implement precision */
|
||||
if (backtick_quoting)
|
||||
{
|
||||
size_t total= my_b_write_backtick_quote(info, (uchar *) par, length2);
|
||||
size_t total= my_b_write_backtick_quote(info, par, length2);
|
||||
if (total == (size_t)-1)
|
||||
goto err;
|
||||
out_length+= total;
|
||||
|
@ -691,15 +691,13 @@ static int setval(const struct my_option *opts, void *value, char *argument,
|
||||
*((double*) value)= getopt_double(argument, opts, &err);
|
||||
break;
|
||||
case GET_STR:
|
||||
if (argument == enabled_my_option)
|
||||
break; /* string options don't use this default of "1" */
|
||||
*((char**) value)= argument;
|
||||
/* If no argument or --enable-string-option, set string to "" */
|
||||
*((char**) value)= argument == enabled_my_option ? (char*) "" : argument;
|
||||
break;
|
||||
case GET_STR_ALLOC:
|
||||
if (argument == enabled_my_option)
|
||||
break; /* string options don't use this default of "1" */
|
||||
my_free(*((char**) value));
|
||||
if (!(*((char**) value)= my_strdup(argument, MYF(MY_WME))))
|
||||
if (!(*((char**) value)= my_strdup(argument == enabled_my_option ? "" :
|
||||
argument, MYF(MY_WME))))
|
||||
{
|
||||
res= EXIT_OUT_OF_MEMORY;
|
||||
goto ret;
|
||||
|
@ -49,6 +49,13 @@ void thr_set_sync_wait_callback(void (*before_wait)(void),
|
||||
(which is correct behaviour, if we know that the other thread synced the
|
||||
file before closing)
|
||||
|
||||
MY_SYNC_FILESIZE is useful when syncing a file after it has been extended.
|
||||
On Linux, fdatasync() on ext3/ext4 file systems does not properly flush
|
||||
to disk the inode data required to preserve the added data across a crash
|
||||
(this looks to be a bug). But when a file is extended, inode data will most
|
||||
likely need flushing in any case, so passing MY_SYNC_FILESIZE as flags
|
||||
is not likely to be any slower, and will be crash safe on Linux ext3/ext4.
|
||||
|
||||
RETURN
|
||||
0 ok
|
||||
-1 error
|
||||
@ -84,8 +91,12 @@ int my_sync(File fd, myf my_flags)
|
||||
DBUG_PRINT("info",("fcntl(F_FULLFSYNC) failed, falling back"));
|
||||
#endif
|
||||
#if defined(HAVE_FDATASYNC) && HAVE_DECL_FDATASYNC
|
||||
res= fdatasync(fd);
|
||||
#elif defined(HAVE_FSYNC)
|
||||
if (!(my_flags & MY_SYNC_FILESIZE))
|
||||
res= fdatasync(fd);
|
||||
else
|
||||
{
|
||||
#endif
|
||||
#if defined(HAVE_FSYNC)
|
||||
res= fsync(fd);
|
||||
if (res == -1 && errno == ENOLCK)
|
||||
res= 0; /* Result Bug in Old FreeBSD */
|
||||
@ -94,6 +105,9 @@ int my_sync(File fd, myf my_flags)
|
||||
#else
|
||||
#error Cannot find a way to sync a file, durability in danger
|
||||
res= 0; /* No sync (strange OS) */
|
||||
#endif
|
||||
#if defined(HAVE_FDATASYNC) && HAVE_DECL_FDATASYNC
|
||||
}
|
||||
#endif
|
||||
} while (res == -1 && errno == EINTR);
|
||||
|
||||
|
147
scripts/mytop.sh
147
scripts/mytop.sh
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# $Id: mytop,v 1.90 2010/05/23 10:51:21 mark Exp $
|
||||
# $Id: mytop,v 1.91 2012/01/18 16:49:12 mgrennan Exp $
|
||||
|
||||
=pod
|
||||
|
||||
@ -15,12 +15,13 @@ mytop - display MySQL server performance info like `top'
|
||||
use 5.005;
|
||||
use strict;
|
||||
use DBI;
|
||||
use DBD::mysql;
|
||||
use Getopt::Long;
|
||||
use Socket;
|
||||
use List::Util qw(min max);
|
||||
use File::Basename;
|
||||
|
||||
$main::VERSION = "1.9a";
|
||||
$main::VERSION = "1.91a";
|
||||
my $path_for_script= dirname($0);
|
||||
|
||||
$|=1;
|
||||
@ -96,7 +97,7 @@ my %config = (
|
||||
resolve => 0,
|
||||
slow => 10, # slow query time
|
||||
socket => '',
|
||||
sort => 0, # default or reverse sort ("s")
|
||||
sort => 1, # default or reverse sort ("s")
|
||||
user => 'root',
|
||||
fullqueries => 0
|
||||
);
|
||||
@ -378,12 +379,11 @@ while (1)
|
||||
## keystroke command processing (if we get this far)
|
||||
##
|
||||
|
||||
# ! - Force past a replication error
|
||||
|
||||
if ($key eq 'r')
|
||||
if ($key eq '!')
|
||||
{
|
||||
Execute("STOP SLAVE; SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; START SLAVE;");
|
||||
next;
|
||||
Execute("stop slave");
|
||||
Execute("set global sql_slave_skip_counter=1");
|
||||
Execute("start slave");
|
||||
}
|
||||
|
||||
# t - top
|
||||
@ -415,7 +415,7 @@ while (1)
|
||||
next;
|
||||
}
|
||||
|
||||
## m - mode swtich to qps
|
||||
## m - mode switch to qps
|
||||
|
||||
if ($key eq 'm')
|
||||
{
|
||||
@ -425,17 +425,7 @@ while (1)
|
||||
next;
|
||||
}
|
||||
|
||||
## M - mode swtich to qps
|
||||
|
||||
if ($key eq 'M')
|
||||
{
|
||||
$config{mode} = 'status';
|
||||
Clear() unless $config{batchmode};
|
||||
print "Queries Per Second [hit q to exit this mode]\n";
|
||||
next;
|
||||
}
|
||||
|
||||
## c - mode swtich to command summary
|
||||
## c - mode switch to command summary
|
||||
|
||||
if ($key eq 'c')
|
||||
{
|
||||
@ -467,8 +457,6 @@ while (1)
|
||||
next;
|
||||
}
|
||||
|
||||
# Change the SLOW query value
|
||||
|
||||
if ($key eq 'S')
|
||||
{
|
||||
cmd_S();
|
||||
@ -755,7 +743,9 @@ while (1)
|
||||
ReadKey(0);
|
||||
}
|
||||
|
||||
if ($key eq 'S')
|
||||
# Switch to show status mode
|
||||
|
||||
if ($key eq 'M')
|
||||
{
|
||||
$config{mode} = 'status';
|
||||
}
|
||||
@ -931,6 +921,11 @@ sub GetData()
|
||||
}
|
||||
}
|
||||
|
||||
open L, "</proc/loadavg";
|
||||
my $l = <L>;
|
||||
close L;
|
||||
chomp $l;
|
||||
|
||||
$last_time = $now_time;
|
||||
|
||||
## Server Uptime in meaningful terms...
|
||||
@ -962,6 +957,7 @@ sub GetData()
|
||||
printf "%-.${host_width}s %${up_width}s\n",
|
||||
"$server on $config{host} ($db_version)",
|
||||
"up $uptime $current_time";
|
||||
# "load $l up $uptime $current_time";
|
||||
$lines_left--;
|
||||
|
||||
|
||||
@ -1055,19 +1051,29 @@ sub GetData()
|
||||
|
||||
if ($t_delta)
|
||||
{
|
||||
my $rows_read;
|
||||
if (defined($STATUS{Rows_read}))
|
||||
{
|
||||
$rows_read= $STATUS{Rows_read} - $OLD_STATUS{Rows_read};
|
||||
}
|
||||
else
|
||||
{
|
||||
$rows_read=
|
||||
($STATUS{Handler_read_first}+$STATUS{Handler_read_key}+
|
||||
$STATUS{Handler_read_next}+$STATUS{Handler_read_prev}+
|
||||
$STATUS{Handler_read_rnd}+$STATUS{Handler_read_rnd_next} -
|
||||
$OLD_STATUS{Handler_read_first}-$OLD_STATUS{Handler_read_key}-
|
||||
$OLD_STATUS{Handler_read_next}-$OLD_STATUS{Handler_read_prev}-
|
||||
$OLD_STATUS{Handler_read_rnd}-
|
||||
$OLD_STATUS{Handler_read_rnd_next});
|
||||
}
|
||||
printf(" Handler: (R/W/U/D) %5d/%5d/%5d/%5d Tmp: R/W/U: %5d/%5d/%5d\n",
|
||||
($STATUS{Handler_read_first}+$STATUS{Handler_read_key}+
|
||||
$STATUS{Handler_read_next}+$STATUS{Handler_read_prev}+
|
||||
$STATUS{Handler_read_rnd}+$STATUS{Handler_read_rnd_next} -
|
||||
$OLD_STATUS{Handler_read_first}-$OLD_STATUS{Handler_read_key}-
|
||||
$OLD_STATUS{Handler_read_next}-$OLD_STATUS{Handler_read_prev}-
|
||||
$OLD_STATUS{Handler_read_rnd}-
|
||||
$OLD_STATUS{Handler_read_rnd_next})/$t_delta,
|
||||
$rows_read/$t_delta,
|
||||
($STATUS{Handler_write} - $OLD_STATUS{Handler_write}) /
|
||||
$t_delta,
|
||||
($STATUS{Handler_update} - $OLD_STATUS{Handler_update}) /
|
||||
$t_delta,
|
||||
($STATUS{Handler_delete} - $OLD_STATUS{Handler_delete}) /
|
||||
($STATUS{Handler_delete} - $OLD_STATUS{Handler_delete}) /
|
||||
$t_delta,
|
||||
($STATUS{Rows_tmp_read} - $OLD_STATUS{Rows_tmp_read}) /
|
||||
$t_delta,
|
||||
@ -1083,7 +1089,7 @@ sub GetData()
|
||||
|
||||
$lines_left--;
|
||||
|
||||
printf(" MyISAM Key Efficiency: %2.1f%% Bps in/out: %5s/%5s ",
|
||||
printf(" ISAM Key Efficiency: %2.1f%% Bps in/out: %5s/%5s ",
|
||||
$cache_hits_percent,
|
||||
make_short($STATUS{Bytes_received} / $STATUS{Uptime} ),
|
||||
make_short($STATUS{Bytes_sent} / $STATUS{Uptime}));
|
||||
@ -1095,35 +1101,40 @@ sub GetData()
|
||||
|
||||
$lines_left--;
|
||||
|
||||
my($data) = Hashes('SHOW SLAVE STATUS');
|
||||
my($data) = Hashes('show global variables like "read_only"');
|
||||
if ($data->{Value} ne "OFF")
|
||||
{
|
||||
print RED() if ($HAS_COLOR) ;
|
||||
print " ReadOnly";
|
||||
RESET() if ($HAS_COLOR);
|
||||
}
|
||||
|
||||
($data) = Hashes('SHOW SLAVE STATUS');
|
||||
if (defined($data->{Master_Host}))
|
||||
{
|
||||
if (defined($data->{Seconds_Behind_Master}))
|
||||
{
|
||||
if ($HAS_COLOR) {
|
||||
print GREEN();
|
||||
print YELLOW() if ($data->{Seconds_Behind_Master} > 60);
|
||||
print MAGENTA() if ($data->{Seconds_Behind_Master} > 360);
|
||||
}
|
||||
}
|
||||
print " Replication ";
|
||||
if ($HAS_COLOR) {
|
||||
print GREEN();
|
||||
print RED() if ($data->{Slave_IO_Running} ne "Yes") ;
|
||||
}
|
||||
print "IO:$data->{Slave_IO_Running} ";
|
||||
RESET() if ($HAS_COLOR);
|
||||
|
||||
if ($HAS_COLOR) {
|
||||
print GREEN();
|
||||
print RED() if ($data->{Slave_SQL_Running} ne "Yes") ;
|
||||
}
|
||||
print "SQL:$data->{Slave_SQL_Running} ";
|
||||
print RESET() if ($HAS_COLOR);
|
||||
|
||||
my $SlaveDelay = $data->{Seconds_Behind_Master};
|
||||
if ($SlaveDelay)
|
||||
if (defined($data->{Seconds_Behind_Master}))
|
||||
{
|
||||
if ($HAS_COLOR) {
|
||||
print GREEN();
|
||||
print YELLOW() if ($SlaveDelay > 10);
|
||||
print MAGENTA() if ($SlaveDelay > 120);
|
||||
print YELLOW() if ($data->{Seconds_Behind_Master} > 60);
|
||||
print MAGENTA() if ($data->{Seconds_Behind_Master} > 360);
|
||||
}
|
||||
print "Delay: $SlaveDelay sec.";
|
||||
print "Delay: $data->{Seconds_Behind_Master} sec.";
|
||||
} else {
|
||||
my $free = $width - 35;
|
||||
my $free = $width - 45;
|
||||
my $Err = substr $data->{Last_Error},0 ,$free;
|
||||
printf(" ERR: %-${free}s", $Err) if ( $Err ne "" );
|
||||
}
|
||||
@ -1198,6 +1209,7 @@ sub GetData()
|
||||
if ($is_ip and $config{resolve})
|
||||
{
|
||||
$thread->{Host} =~ s/:\d+$//;
|
||||
# my $host = $thread->{Host};
|
||||
my $host = gethostbyaddr(inet_aton($thread->{Host}), AF_INET);
|
||||
# $host =~ s/^([^.]+).*/$1/;
|
||||
$thread->{Host} = $host;
|
||||
@ -1483,7 +1495,7 @@ sub GetShowStatus()
|
||||
Clear() unless $config{batchmode};
|
||||
my @rows = Hashes("SHOW STATUS");
|
||||
|
||||
printf "%32s %10s %10s\n", 'Counter', 'Total', 'Change';
|
||||
printf "%32s %10s %10s Toggle idle with 'i'\n", 'Counter', 'Total', 'Change';
|
||||
printf "%32s %10s %10s\n", '-------', '-----', '------';
|
||||
|
||||
for my $row (@rows)
|
||||
@ -1519,9 +1531,7 @@ sub GetShowStatus()
|
||||
}
|
||||
}
|
||||
|
||||
if ($delta != 0) {
|
||||
printf "%32s: %10s %10s\n", $name, $value, $delta;
|
||||
}
|
||||
printf "%32s: %10s %10s\n", $name, $value, $delta;
|
||||
print RESET() if $HAS_COLOR;
|
||||
|
||||
$statcache{$name} = $value;
|
||||
@ -1703,12 +1713,11 @@ sub trim($)
|
||||
sub PrintHelp()
|
||||
{
|
||||
my $help = qq[
|
||||
Help for mytop version $main::VERSION by Mark Grennan <${YELLOW}Mark\@Grennan.com${RESET}>
|
||||
Origional work by Jeremy D. Zawodny <${YELLOW}Jeremy\@Zawodny.com${RESET}>
|
||||
Help for mytop version $main::VERSION by Jeremy D. Zawodny <${YELLOW}Jeremy\@Zawodny.com${RESET}>
|
||||
with updates by Mark Grennan <${YELLOW}mark\@grennan.com${RESET}>
|
||||
|
||||
? - display this screen
|
||||
# - toggle short/long numbers (not yet implemented)
|
||||
! - force past replication error
|
||||
c - command summary view (based on Com_* counters)
|
||||
C - turn color on and off
|
||||
d - show only a specific database
|
||||
@ -1733,8 +1742,9 @@ Origional work by Jeremy D. Zawodny <${YELLOW}Jeremy\@Zawodny.com${RESET}>
|
||||
S - change slow quiery hightlighting
|
||||
t - switch to thread view (default)
|
||||
u - show only a specific user
|
||||
V - show variablesi
|
||||
V - show variables
|
||||
: - enter a command (not yet implemented)
|
||||
! - Skip an error that has stopped replications (at your own risk)
|
||||
L - show full queries (do not strip to terminal width)
|
||||
|
||||
Base version from ${GREEN}http://www.mysqlfanboy.com/mytop${RESET}
|
||||
@ -2317,11 +2327,8 @@ having the User column appear, for example.
|
||||
mytop was developed and is maintained by Jeremy D. Zawodny
|
||||
(Jeremy@Zawodny.com).
|
||||
|
||||
(Mark Grennan) After weeks and months of trying to get Jeremy's
|
||||
attention I desided to release my own update to mytop. I use it
|
||||
every day as a part of my job. Thanks Jeremy for creating mytop.
|
||||
I hope you find my updates as helpful as I have. I can be
|
||||
reached at (Mark@Grennan.com).
|
||||
If you wish to e-mail me regarding this software, B<PLEASE> subscribe
|
||||
to the B<mytop> mailing list. See the B<mytop> homepage for details.
|
||||
|
||||
=head1 DISCLAIMER
|
||||
|
||||
@ -2330,12 +2337,6 @@ for it. Yahoo! does not necessarily support this software in any
|
||||
way. It is merely a personal idea which happened to be very useful in
|
||||
my job.
|
||||
|
||||
=head1 RECRUITING
|
||||
|
||||
If you hack Perl and grok MySQL, come work at Yahoo! Contact me for
|
||||
details. Or just send me your resume. Er, unless we just had layoffs,
|
||||
in which case we're not hiring. :-(
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
Please check the MySQL manual if you're not sure where some of the
|
||||
@ -2344,7 +2345,6 @@ output of B<mytop> is coming from.
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright (C) 2000-2010, Jeremy D. Zawodny.
|
||||
Copyright (C) 2010, Mark T. Grennan.
|
||||
|
||||
=head1 CREDITS
|
||||
|
||||
@ -2358,6 +2358,15 @@ Many thanks go to these fine folks:
|
||||
|
||||
Added --fullqueries and reading of .my.cnf
|
||||
|
||||
=item Mark Grennan (mark@grennan.com) www.linuxfangoy.com
|
||||
|
||||
Added updates for MySQL 5.x. Added 'S' (slow) highlighting.
|
||||
Added 'C' to turn on and off Color. Added 'l' command to change
|
||||
color for long running queries. Fixed a few documentation issues.
|
||||
Monitors Slave status. Added color to Queue hit ratio.
|
||||
Added number of rows sorted per second.
|
||||
Created release 1.7.
|
||||
|
||||
=item Sami Ahlroos (sami@avis-net.de)
|
||||
|
||||
Suggested the idle/noidle stuff.
|
||||
|
@ -177,8 +177,8 @@ bool read_texts(const char *file_name, const char *language,
|
||||
O_RDONLY | O_SHARE | O_BINARY,
|
||||
MYF(0))) < 0)
|
||||
goto err;
|
||||
sql_print_error("An old style --language value with language specific part detected: %s", lc_messages_dir);
|
||||
sql_print_error("Use --lc-messages-dir without language specific part instead.");
|
||||
sql_print_warning("An old style --language or -lc-message-dir value with language specific part detected: %s", lc_messages_dir);
|
||||
sql_print_warning("Use --lc-messages-dir without language specific part instead.");
|
||||
}
|
||||
|
||||
funktpos=1;
|
||||
|
@ -42,7 +42,7 @@
|
||||
cond_wait(mythd, abstime, msg, SCHED_FUNC, __LINE__)
|
||||
|
||||
extern pthread_attr_t connection_attrib;
|
||||
|
||||
extern ulong event_executed;
|
||||
|
||||
Event_db_repository *Event_worker_thread::db_repository;
|
||||
|
||||
@ -557,7 +557,8 @@ Event_scheduler::execute_top(Event_queue_element_for_exec *event_name)
|
||||
event_name)))
|
||||
goto error;
|
||||
|
||||
++started_events;
|
||||
started_events++;
|
||||
executed_events++; // For SHOW STATUS
|
||||
|
||||
DBUG_PRINT("info", ("Event is in THD: 0x%lx", (long) new_thd));
|
||||
DBUG_RETURN(FALSE);
|
||||
|
@ -5677,7 +5677,7 @@ bool Field_newdate::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate)
|
||||
if (!tmp)
|
||||
return fuzzydate & TIME_NO_ZERO_DATE;
|
||||
if (!ltime->month || !ltime->day)
|
||||
return !(fuzzydate & TIME_FUZZY_DATE);
|
||||
return fuzzydate & TIME_NO_ZERO_IN_DATE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -9395,9 +9395,12 @@ Field *make_field(TABLE_SHARE *share, uchar *ptr, uint32 field_length,
|
||||
|
||||
#ifdef HAVE_SPATIAL
|
||||
if (f_is_geom(pack_flag))
|
||||
{
|
||||
status_var_increment(current_thd->status_var.feature_gis);
|
||||
return new Field_geom(ptr,null_pos,null_bit,
|
||||
unireg_check, field_name, share,
|
||||
pack_length, geom_type);
|
||||
}
|
||||
#endif
|
||||
if (f_is_blob(pack_flag))
|
||||
return new Field_blob(ptr,null_pos,null_bit,
|
||||
|
@ -2552,6 +2552,8 @@ int handler::update_auto_increment()
|
||||
bool append= FALSE;
|
||||
THD *thd= table->in_use;
|
||||
struct system_variables *variables= &thd->variables;
|
||||
int result=0, tmp;
|
||||
enum enum_check_fields save_count_cuted_fields;
|
||||
DBUG_ENTER("handler::update_auto_increment");
|
||||
|
||||
/*
|
||||
@ -2569,8 +2571,10 @@ int handler::update_auto_increment()
|
||||
statement (case of INSERT VALUES(null),(3763),(null):
|
||||
the last NULL needs to insert 3764, not the value of the first NULL plus
|
||||
1).
|
||||
Ignore negative values.
|
||||
*/
|
||||
adjust_next_insert_id_after_explicit_value(nr);
|
||||
if ((longlong) nr > 0 || (table->next_number_field->flags & UNSIGNED_FLAG))
|
||||
adjust_next_insert_id_after_explicit_value(nr);
|
||||
insert_id_for_cur_row= 0; // didn't generate anything
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
@ -2629,7 +2633,6 @@ int handler::update_auto_increment()
|
||||
else
|
||||
nb_desired_values= AUTO_INC_DEFAULT_NB_MAX;
|
||||
}
|
||||
/* This call ignores all its parameters but nr, currently */
|
||||
get_auto_increment(variables->auto_increment_offset,
|
||||
variables->auto_increment_increment,
|
||||
nb_desired_values, &nr,
|
||||
@ -2666,29 +2669,23 @@ int handler::update_auto_increment()
|
||||
}
|
||||
|
||||
if (unlikely(nr == ULONGLONG_MAX))
|
||||
DBUG_RETURN(HA_ERR_AUTOINC_ERANGE);
|
||||
DBUG_RETURN(HA_ERR_AUTOINC_ERANGE);
|
||||
|
||||
DBUG_PRINT("info",("auto_increment: %lu", (ulong) nr));
|
||||
|
||||
if (unlikely(table->next_number_field->store((longlong) nr, TRUE)))
|
||||
/* Store field without warning (Warning will be printed by insert) */
|
||||
save_count_cuted_fields= thd->count_cuted_fields;
|
||||
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
|
||||
tmp= table->next_number_field->store((longlong) nr, TRUE);
|
||||
thd->count_cuted_fields= save_count_cuted_fields;
|
||||
|
||||
if (unlikely(tmp)) // Out of range value in store
|
||||
{
|
||||
/*
|
||||
first test if the query was aborted due to strict mode constraints
|
||||
It's better to return an error here than getting a confusing
|
||||
'duplicate key error' later.
|
||||
*/
|
||||
if (killed_mask_hard(thd->killed) == KILL_BAD_DATA)
|
||||
DBUG_RETURN(HA_ERR_AUTOINC_ERANGE);
|
||||
|
||||
/*
|
||||
field refused this value (overflow) and truncated it, use the result of
|
||||
the truncation (which is going to be inserted); however we try to
|
||||
decrease it to honour auto_increment_* variables.
|
||||
That will shift the left bound of the reserved interval, we don't
|
||||
bother shifting the right bound (anyway any other value from this
|
||||
interval will cause a duplicate key).
|
||||
*/
|
||||
nr= prev_insert_id(table->next_number_field->val_int(), variables);
|
||||
if (unlikely(table->next_number_field->store((longlong) nr, TRUE)))
|
||||
nr= table->next_number_field->val_int();
|
||||
result= HA_ERR_AUTOINC_ERANGE;
|
||||
}
|
||||
if (append)
|
||||
{
|
||||
@ -2710,6 +2707,10 @@ int handler::update_auto_increment()
|
||||
already set.
|
||||
*/
|
||||
insert_id_for_cur_row= nr;
|
||||
|
||||
if (result) // overflow
|
||||
DBUG_RETURN(result);
|
||||
|
||||
/*
|
||||
Set next insert id to point to next auto-increment value to be able to
|
||||
handle multi-row statements.
|
||||
@ -2833,7 +2834,7 @@ void handler::ha_release_auto_increment()
|
||||
}
|
||||
|
||||
|
||||
void handler::print_keydup_error(uint key_nr, const char *msg)
|
||||
void handler::print_keydup_error(uint key_nr, const char *msg, myf errflag)
|
||||
{
|
||||
/* Write the duplicated key in the error message */
|
||||
char key[MAX_KEY_LENGTH];
|
||||
@ -2843,7 +2844,7 @@ void handler::print_keydup_error(uint key_nr, const char *msg)
|
||||
{
|
||||
/* Key is unknown */
|
||||
str.copy("", 0, system_charset_info);
|
||||
my_printf_error(ER_DUP_ENTRY, msg, MYF(0), str.c_ptr(), "*UNKNOWN*");
|
||||
my_printf_error(ER_DUP_ENTRY, msg, errflag, str.c_ptr(), "*UNKNOWN*");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2856,7 +2857,7 @@ void handler::print_keydup_error(uint key_nr, const char *msg)
|
||||
str.append(STRING_WITH_LEN("..."));
|
||||
}
|
||||
my_printf_error(ER_DUP_ENTRY, msg,
|
||||
MYF(0), str.c_ptr_safe(), table->key_info[key_nr].name);
|
||||
errflag, str.c_ptr_safe(), table->key_info[key_nr].name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2924,7 +2925,7 @@ void handler::print_error(int error, myf errflag)
|
||||
uint key_nr=get_dup_key(error);
|
||||
if ((int) key_nr >= 0)
|
||||
{
|
||||
print_keydup_error(key_nr, ER(ER_DUP_ENTRY_WITH_KEY_NAME));
|
||||
print_keydup_error(key_nr, ER(ER_DUP_ENTRY_WITH_KEY_NAME), errflag);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
}
|
||||
@ -3087,7 +3088,10 @@ void handler::print_error(int error, myf errflag)
|
||||
textno= ER_AUTOINC_READ_FAILED;
|
||||
break;
|
||||
case HA_ERR_AUTOINC_ERANGE:
|
||||
textno= ER_WARN_DATA_OUT_OF_RANGE;
|
||||
textno= error;
|
||||
my_error(textno, errflag, table->next_number_field->field_name,
|
||||
table->in_use->warning_info->current_row_for_warning());
|
||||
DBUG_VOID_RETURN;
|
||||
break;
|
||||
case HA_ERR_TOO_MANY_CONCURRENT_TRXS:
|
||||
textno= ER_TOO_MANY_CONCURRENT_TRXS;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user