1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge branch '10.1' into pull-request-97

Merge downstream Debian packaging (MDEV-6284)
This commit is contained in:
Sergei Golubchik
2015-09-25 10:24:14 +02:00
306 changed files with 8618 additions and 2027 deletions

View File

@@ -1,4 +1,4 @@
MYSQL_VERSION_MAJOR=10
MYSQL_VERSION_MINOR=1
MYSQL_VERSION_PATCH=7
MYSQL_VERSION_PATCH=8
MYSQL_VERSION_EXTRA=

View File

@@ -87,6 +87,7 @@
#cmakedefine HAVE_SYS_UTSNAME_H 1
#cmakedefine HAVE_SYS_STAT_H 1
#cmakedefine HAVE_SYS_STREAM_H 1
#cmakedefine HAVE_SYS_SYSCALL_H 1
#cmakedefine HAVE_SYS_TERMCAP_H 1
#cmakedefine HAVE_SYS_TIMEB_H 1
#cmakedefine HAVE_SYS_TIMES_H 1

View File

@@ -228,6 +228,7 @@ CHECK_INCLUDE_FILES ("sys/types.h;sys/shm.h" HAVE_SYS_SHM_H)
CHECK_INCLUDE_FILES (sys/socket.h HAVE_SYS_SOCKET_H)
CHECK_INCLUDE_FILES (sys/stat.h HAVE_SYS_STAT_H)
CHECK_INCLUDE_FILES (sys/stream.h HAVE_SYS_STREAM_H)
CHECK_INCLUDE_FILES (sys/syscall.h HAVE_SYS_SYSCALL_H)
CHECK_INCLUDE_FILES (sys/termcap.h HAVE_SYS_TERMCAP_H)
CHECK_INCLUDE_FILES ("curses.h;term.h" HAVE_TERM_H)
CHECK_INCLUDE_FILES (asm/termbits.h HAVE_ASM_TERMBITS_H)

View File

@@ -156,6 +156,7 @@ innodb_flush_method = O_DIRECT
#
[galera]
# Mandatory settings
#wsrep_on=ON
#wsrep_provider=
#wsrep_cluster_address=
#binlog_format=row

View File

@@ -62,6 +62,7 @@ The parts not included are excluded by #ifndef UNIV_INNOCHECKSUM. */
#include "fsp0fsp.h" /* fsp_flags_get_page_size() &
fsp_flags_get_zip_size() */
#include "ut0crc32.h" /* ut_crc32_init() */
#include "fsp0pagecompress.h" /* fil_get_compression_alg_name */
#ifdef UNIV_NONINL
# include "fsp0fsp.ic"
@@ -109,6 +110,8 @@ int n_fil_page_type_xdes;
int n_fil_page_type_blob;
int n_fil_page_type_zblob;
int n_fil_page_type_other;
int n_fil_page_type_page_compressed;
int n_fil_page_type_page_compressed_encrypted;
int n_fil_page_max_index_id;
@@ -152,6 +155,8 @@ struct per_index_stats {
std::map<unsigned long long, per_index_stats> index_ids;
bool encrypted = false;
/* Get the page size of the filespace from the filespace header. */
static
my_bool
@@ -197,6 +202,8 @@ get_page_size(
{
compressed= true;
}
return TRUE;
}
@@ -515,6 +522,18 @@ parse_page(
}
n_fil_page_type_zblob++;
break;
case FIL_PAGE_PAGE_COMPRESSED:
if (per_page_details) {
printf("FIL_PAGE_PAGE_COMPRESSED\n");
}
n_fil_page_type_page_compressed++;
break;
case FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED:
if (per_page_details) {
printf("FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED\n");
}
n_fil_page_type_page_compressed_encrypted++;
break;
default:
if (per_page_details) {
printf("FIL_PAGE_TYPE_OTHER\n");
@@ -604,6 +623,8 @@ print_stats()
printf("%d\tFIL_PAGE_TYPE_XDES\n", n_fil_page_type_xdes);
printf("%d\tFIL_PAGE_TYPE_BLOB\n", n_fil_page_type_blob);
printf("%d\tFIL_PAGE_TYPE_ZBLOB\n", n_fil_page_type_zblob);
printf("%d\tFIL_PAGE_PAGE_COMPRESSED\n", n_fil_page_type_page_compressed);
printf("%d\tFIL_PAGE_PAGE_COMPRESSED_ENCRYPTED\n", n_fil_page_type_page_compressed_encrypted);
printf("%d\tother\n", n_fil_page_type_other);
printf("%d\tmax index_id\n", n_fil_page_max_index_id);
printf("undo type: %d insert, %d update, %d other\n",
@@ -791,7 +812,9 @@ int main(int argc, char **argv)
while (!feof(f))
{
int page_ok = 1;
bytes= fread(buf, 1, physical_page_size, f);
if (!bytes && feof(f))
{
print_stats();
@@ -809,8 +832,54 @@ int main(int argc, char **argv)
return 1;
}
if (compressed) {
ulint page_type = mach_read_from_2(buf+FIL_PAGE_TYPE);
ulint key_version = mach_read_from_4(buf + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
if (key_version && page_type != FIL_PAGE_PAGE_COMPRESSED) {
encrypted = true;
} else {
encrypted = false;
}
ulint comp_method = 0;
if (encrypted) {
comp_method = mach_read_from_2(buf+FIL_PAGE_DATA+FIL_PAGE_COMPRESSED_SIZE);
} else {
comp_method = mach_read_from_8(buf+FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
}
ulint comp_size = mach_read_from_2(buf+FIL_PAGE_DATA);
ib_uint32_t encryption_checksum = mach_read_from_4(buf+FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + 4);
if (page_type == FIL_PAGE_PAGE_COMPRESSED) {
/* Page compressed tables do not have any checksum */
if (debug)
fprintf(stderr, "Page %lu page compressed with method %s real_size %lu\n", ct,
fil_get_compression_alg_name(comp_method), comp_size);
page_ok = 1;
} else if (compressed) {
/* compressed pages */
ulint crccsum = page_zip_calc_checksum(buf, physical_page_size, SRV_CHECKSUM_ALGORITHM_CRC32);
ulint icsum = page_zip_calc_checksum(buf, physical_page_size, SRV_CHECKSUM_ALGORITHM_INNODB);
if (debug) {
if (key_version != 0) {
fprintf(stderr,
"Page %lu encrypted key_version %lu calculated = %lu; crc32 = %lu; recorded = %u\n",
ct, key_version, icsum, crccsum, encryption_checksum);
}
}
if (encrypted) {
if (encryption_checksum != 0 && crccsum != encryption_checksum && icsum != encryption_checksum) {
if (debug)
fprintf(stderr, "page %lu: compressed: calculated = %lu; crc32 = %lu; recorded = %u\n",
ct, icsum, crccsum, encryption_checksum);
fprintf(stderr, "Fail; page %lu invalid (fails compressed page checksum).\n", ct);
}
} else {
if (!page_zip_verify_checksum(buf, physical_page_size)) {
fprintf(stderr, "Fail; page %lu invalid (fails compressed page checksum).\n", ct);
if (!skip_corrupt)
@@ -821,8 +890,25 @@ int main(int argc, char **argv)
}
page_ok = 0;
}
}
} else {
if (key_version != 0) {
/* Encrypted page */
if (debug) {
if (page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) {
fprintf(stderr,
"Page %lu page compressed with method %s real_size %lu and encrypted key_version %lu checksum %u\n",
ct, fil_get_compression_alg_name(comp_method), comp_size, key_version, encryption_checksum);
} else {
fprintf(stderr,
"Page %lu encrypted key_version %lu checksum %u\n",
ct, key_version, encryption_checksum);
}
}
}
/* Page compressed tables do not contain FIL tailer */
if (page_type != FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED && page_type != FIL_PAGE_PAGE_COMPRESSED) {
/* check the "stored log sequence numbers" */
logseq= mach_read_from_4(buf + FIL_PAGE_LSN + 4);
logseqfield= mach_read_from_4(buf + logical_page_size - FIL_PAGE_END_LSN_OLD_CHKSUM + 4);
@@ -856,11 +942,16 @@ int main(int argc, char **argv)
}
page_ok = 0;
}
}
/* now check the new method */
csum= buf_calc_page_new_checksum(buf);
crc32= buf_calc_page_crc32(buf);
csumfield= mach_read_from_4(buf + FIL_PAGE_SPACE_OR_CHKSUM);
if (key_version)
csumfield = encryption_checksum;
if (debug)
printf("page %lu: new style: calculated = %lu; crc32 = %lu; recorded = %lu\n",
ct, csum, crc32, csumfield);
@@ -903,7 +994,10 @@ int main(int argc, char **argv)
continue;
}
/* Can't parse compressed or/and encrypted pages */
if (page_type != FIL_PAGE_PAGE_COMPRESSED && !encrypted) {
parse_page(buf, xdes);
}
if (verbose)
{

View File

@@ -501,7 +501,9 @@ enum ha_base_keytype {
#define HA_ERR_DISK_FULL 189
#define HA_ERR_INCOMPATIBLE_DEFINITION 190
#define HA_ERR_FTS_TOO_MANY_WORDS_IN_PHRASE 191 /* Too many words in a phrase */
#define HA_ERR_LAST 191 /* Copy of last error nr */
#define HA_ERR_DECRYPTION_FAILED 192 /* Table encrypted but
decypt failed */
#define HA_ERR_LAST 192 /* Copy of last error nr */
/* Number of different errors */
#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1)

View File

@@ -94,7 +94,8 @@ static const char *handler_error_messages[]=
"Operation was interrupted by end user (probably kill command?)",
"Disk full",
"Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine. You have to dump and restore the table to fix this",
"Too many words in a FTS phrase or proximity search"
"Too many words in a FTS phrase or proximity search",
"Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match."
};
#endif /* MYSYS_MY_HANDLER_ERRORS_INCLUDED */

View File

@@ -77,7 +77,7 @@ eval CREATE TABLE t1 (
#
c28 DATE,
c29 DATETIME,
c30 TIMESTAMP,
c30 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
c31 TIME,
c32 YEAR,
#

View File

@@ -398,7 +398,8 @@ sync_slave_with_master;
STOP SLAVE;
RESET SLAVE;
eval CREATE TABLE t9 (a INT KEY, b BLOB, c CHAR(5),
d TIMESTAMP,
d TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP,
e INT NOT NULL,
f text not null,
g text,

View File

@@ -1166,7 +1166,7 @@ create table t2 as select concat(a) from t1;
show create table t2;
drop table t1, t2;
create table t1 (a timestamp);
create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
insert into t1 values (0);
insert into t1 values (20010203040506);
insert into t1 values (19800203040506);
@@ -1478,7 +1478,7 @@ select hex(a) from v1;
drop table t1;
drop view v1;
create table t1 (a timestamp);
create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
insert into t1 values (0);
insert into t1 values (20010203040506);
insert into t1 values (19800203040506);

View File

@@ -500,7 +500,7 @@ drop table t1;
# Test of opening table twice and timestamps
#
set @a:=now();
eval CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=$engine_type;
eval CREATE TABLE t1 (a int not null, b timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, primary key (a)) engine=$engine_type;
insert into t1 (a) values(1),(2),(3);
select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a;
select a from t1 natural join t1 as t2 where b >= @a order by a;
@@ -727,9 +727,9 @@ eval CREATE TABLE t1 (
cname char(15) NOT NULL default '',
carrier_id smallint(6) NOT NULL default '0',
privacy tinyint(4) NOT NULL default '0',
last_mod_date timestamp NOT NULL,
last_mod_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
last_mod_id smallint(6) NOT NULL default '0',
last_app_date timestamp NOT NULL,
last_app_date timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
last_app_id smallint(6) default '-1',
version smallint(6) NOT NULL default '0',
assigned_scps int(11) default '0',
@@ -746,9 +746,9 @@ eval CREATE TABLE t2 (
cname char(15) NOT NULL default '',
carrier_id smallint(6) NOT NULL default '0',
privacy tinyint(4) NOT NULL default '0',
last_mod_date timestamp NOT NULL,
last_mod_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
last_mod_id smallint(6) NOT NULL default '0',
last_app_date timestamp NOT NULL,
last_app_date timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
last_app_id smallint(6) default '-1',
version smallint(6) NOT NULL default '0',
assigned_scps int(11) default '0',

View File

@@ -165,6 +165,9 @@ INSERT INTO global_suppressions VALUES
("The slave I.O thread stops because a fatal error is encountered when it try to get the value of SERVER_ID variable from master."),
/*It will print a warning if server is run without --explicit_defaults_for_timestamp.*/
("TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details)*"),
/* Added 2009-08-XX after fixing Bug #42408 */
("Although a path was specified for the .* option, log tables are used"),

View File

@@ -33,7 +33,8 @@ eval create table t9
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
c13 date, c14 datetime, c15 timestamp, c16 time,
c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP, c16 time,
c17 year, c18 tinyint, c19 bool, c20 char,
c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
c25 blob, c26 text, c27 mediumblob, c28 mediumtext,

View File

@@ -25,7 +25,12 @@ alter table t1 engine=innodb;
select * from t1 order by a;
select * from t1 order by a+0;
drop table t1;
eval create table t1 (a $type(4)) engine=innodb;
let attr=;
if ($type == timestamp)
{
let attr=NOT NULL DEFAULT CURRENT_TIMESTAMP(4) ON UPDATE CURRENT_TIMESTAMP(4);
}
eval create table t1 (a $type(4)$attr) engine=innodb;
insert t1 values ('2010-12-11 01:02:03.456789');
select * from t1;
select extract(microsecond from a + interval 100 microsecond) from t1 where a>'2010-11-12 01:02:03.456';
@@ -93,7 +98,12 @@ drop table t1, t2;
#
# SP
#
eval create table t1 (a $type(6), b $type(6));
let attr=;
if ($type == timestamp)
{
let attr=NOT NULL DEFAULT '0000-00-00 00:00:00.000000';
}
eval create table t1 (a $type(6)$attr, b $type(6)$attr);
eval create procedure foo(x $type, y $type(4)) insert into t1 values (x, y);
call foo('2010-02-03 4:5:6.789123', '2010-02-03 4:5:6.789123');
select * from t1;

View File

@@ -467,3 +467,116 @@ ANALYZE
}
}
drop table t0, t1;
#
# MDEV-7970: EXPLAIN FORMAT=JSON does not print HAVING
#
create table t0(a int);
insert into t0 values (0),(1),(2),(3);
create table t1(a int);
insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
create table t2 (
a int,
b int,
key (a)
);
insert into t2 select A.a*1000 + B.a, A.a*1000 + B.a from t0 A, t1 B;
# normal HAVING
analyze format=json select a, max(b) as TOP from t2 group by a having TOP > a;
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"volatile parameter": "REPLACED",
"having_condition": "(TOP > a)",
"filesort": {
"r_loops": 1,
"volatile parameter": "REPLACED",
"r_used_priority_queue": false,
"r_output_rows": 0,
"volatile parameter": "REPLACED",
"temporary_table": {
"table": {
"table_name": "t2",
"access_type": "ALL",
"r_loops": 1,
"rows": 256,
"r_rows": 256,
"volatile parameter": "REPLACED",
"filtered": 100,
"r_filtered": 100
}
}
}
}
}
# HAVING is always TRUE (not printed)
analyze format=json select a, max(b) as TOP from t2 group by a having 1<>2;
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"volatile parameter": "REPLACED",
"filesort": {
"r_loops": 1,
"volatile parameter": "REPLACED",
"r_used_priority_queue": false,
"r_output_rows": 256,
"volatile parameter": "REPLACED",
"temporary_table": {
"table": {
"table_name": "t2",
"access_type": "ALL",
"r_loops": 1,
"rows": 256,
"r_rows": 256,
"volatile parameter": "REPLACED",
"filtered": 100,
"r_filtered": 100
}
}
}
}
}
# HAVING is always FALSE (intercepted by message)
analyze format=json select a, max(b) as TOP from t2 group by a having 1=2;
ANALYZE
{
"query_block": {
"select_id": 1,
"table": {
"message": "Impossible HAVING"
}
}
}
# HAVING is absent
analyze format=json select a, max(b) as TOP from t2 group by a;
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"volatile parameter": "REPLACED",
"filesort": {
"r_loops": 1,
"volatile parameter": "REPLACED",
"r_used_priority_queue": false,
"r_output_rows": 256,
"volatile parameter": "REPLACED",
"temporary_table": {
"table": {
"table_name": "t2",
"access_type": "ALL",
"r_loops": 1,
"rows": 256,
"r_rows": 256,
"volatile parameter": "REPLACED",
"filtered": 100,
"r_filtered": 100
}
}
}
}
}
drop table t0, t1, t2;

View File

@@ -49,5 +49,66 @@ col435
0.00000000000000000
0.00000000000000000
0.00000000000000000
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
set session sort_buffer_size= default;
DROP TABLE t1, t2, t3;

View File

@@ -13,7 +13,7 @@ select CAST('10 ' as unsigned integer);
CAST('10 ' as unsigned integer)
10
Warnings:
Warning 1292 Truncated incorrect INTEGER value: '10 '
Note 1292 Truncated incorrect INTEGER value: '10 '
select cast(-5 as unsigned) | 1, cast(-5 as unsigned) & -1;
cast(-5 as unsigned) | 1 cast(-5 as unsigned) & -1
18446744073709551611 18446744073709551611

View File

@@ -494,7 +494,7 @@ a b c d e f g h dd
1 -7 7 2000-01-01 b 2000-01-01 00:00:00 05:04:03 yet another binary data 02:00:00
2 -2 2 1825-12-14 a 2003-01-01 03:02:01 04:03:02 binary data 02:00:00
drop table t1, t2;
create table t1 (a tinyint, b smallint, c mediumint, d int, e bigint, f float(3,2), g double(4,3), h decimal(5,4), i year, j date, k timestamp, l datetime, m enum('a','b'), n set('a','b'), o char(10));
create table t1 (a tinyint, b smallint, c mediumint, d int, e bigint, f float(3,2), g double(4,3), h decimal(5,4), i year, j date, k timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, l datetime, m enum('a','b'), n set('a','b'), o char(10));
create table t2 select ifnull(a,a), ifnull(b,b), ifnull(c,c), ifnull(d,d), ifnull(e,e), ifnull(f,f), ifnull(g,g), ifnull(h,h), ifnull(i,i), ifnull(j,j), ifnull(k,k), ifnull(l,l), ifnull(m,m), ifnull(n,n), ifnull(o,o) from t1;
show create table t2;
Table Create Table
@@ -1926,7 +1926,8 @@ t1 CREATE TABLE `t1` (
`MEMORY_USED` int(7) NOT NULL DEFAULT '0',
`EXAMINED_ROWS` int(7) NOT NULL DEFAULT '0',
`QUERY_ID` bigint(4) NOT NULL DEFAULT '0',
`INFO_BINARY` blob
`INFO_BINARY` blob,
`TID` bigint(4) NOT NULL DEFAULT '0'
) DEFAULT CHARSET=utf8
drop table t1;
create temporary table t1 like information_schema.processlist;
@@ -1948,7 +1949,8 @@ t1 CREATE TEMPORARY TABLE `t1` (
`MEMORY_USED` int(7) NOT NULL DEFAULT '0',
`EXAMINED_ROWS` int(7) NOT NULL DEFAULT '0',
`QUERY_ID` bigint(4) NOT NULL DEFAULT '0',
`INFO_BINARY` blob
`INFO_BINARY` blob,
`TID` bigint(4) NOT NULL DEFAULT '0'
) DEFAULT CHARSET=utf8
drop table t1;
create table t1 like information_schema.character_sets;
@@ -1970,14 +1972,14 @@ DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
CREATE TABLE t1(c1 TIMESTAMP, c2 TIMESTAMP);
CREATE TABLE t1(c1 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c2 TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00');
SET sql_mode = NO_ZERO_DATE;
CREATE TABLE t2(c1 TIMESTAMP, c2 TIMESTAMP DEFAULT 0);
ERROR 42000: Invalid default value for 'c2'
CREATE TABLE t2(c1 TIMESTAMP, c2 TIMESTAMP);
CREATE TABLE t2(c1 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c2 TIMESTAMP NOT NULL);
ERROR 42000: Invalid default value for 'c2'
# -- Check that NULL column still can be created.

View File

@@ -2076,7 +2076,7 @@ t2 CREATE TABLE `t2` (
`concat(a)` varbinary(64) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
create table t1 (a timestamp);
create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
insert into t1 values (0);
insert into t1 values (20010203040506);
insert into t1 values (19800203040506);
@@ -2388,7 +2388,7 @@ hex(a)
0000000000000001
drop table t1;
drop view v1;
create table t1 (a timestamp);
create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
insert into t1 values (0);
insert into t1 values (20010203040506);
insert into t1 values (19800203040506);

View File

@@ -2470,7 +2470,7 @@ t2 CREATE TABLE `t2` (
`concat(a)` varbinary(64) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
create table t1 (a timestamp);
create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
insert into t1 values (0);
insert into t1 values (20010203040506);
insert into t1 values (19800203040506);
@@ -2782,7 +2782,7 @@ hex(a)
0000000000000001
drop table t1;
drop view v1;
create table t1 (a timestamp);
create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
insert into t1 values (0);
insert into t1 values (20010203040506);
insert into t1 values (19800203040506);
@@ -3345,12 +3345,18 @@ INSERT INTO t1 VALUES (' 1'),('`1');
SELECT * FROM t1 WHERE a IN (1,2,3);
a
1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '`1'
SELECT * FROM t1 WHERE a IN (1,2,3) AND a=' 1';
a
1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '`1'
SELECT * FROM t1 WHERE a IN (1,2,3,'4') AND a=' 1';
a
1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '`1'
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2,3) AND a=' 1';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where

View File

@@ -2752,7 +2752,7 @@ t2 CREATE TABLE `t2` (
`concat(a)` varbinary(64) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
create table t1 (a timestamp);
create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
insert into t1 values (0);
insert into t1 values (20010203040506);
insert into t1 values (19800203040506);
@@ -3064,7 +3064,7 @@ hex(a)
0000000000000001
drop table t1;
drop view v1;
create table t1 (a timestamp);
create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
insert into t1 values (0);
insert into t1 values (20010203040506);
insert into t1 values (19800203040506);
@@ -8168,5 +8168,18 @@ SELECT * FROM t1 WHERE a=_latin1'a' AND a=_latin1'A';
a
DROP TABLE t1;
#
# MDEV-8253 EXPLAIN SELECT prints unexpected characters
#
SET NAMES latin1;
CREATE TABLE t1 (a DECIMAL(10,1),b DECIMAL(10,1),c VARCHAR(10),d VARCHAR(10));
INSERT INTO t1 VALUES (1.5,1.5,'1','1'),(3.5,3.5,'3','3');
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE COALESCE(c,0)='3 ' AND COALESCE(d,0)=COALESCE(c,0);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d` from `test`.`t1` where ((coalesce(`test`.`t1`.`c`,0) = '3 ') and (coalesce(`test`.`t1`.`d`,0) = '3 '))
DROP TABLE t1;
#
# End of 10.1 tests
#

View File

@@ -1694,6 +1694,7 @@ DO CONVERT(CAST(SUBSTRING_INDEX(FORMAT(1,'1111'), FORMAT('','Zpq'),1)
AS BINARY(0)) USING utf8);
Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'Zpq'
Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect BINARY(0) value: '1.'
#
# End of 5.1 tests

View File

@@ -3685,7 +3685,7 @@ t2 CREATE TABLE `t2` (
`concat(a)` varbinary(64) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
create table t1 (a timestamp);
create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
insert into t1 values (0);
insert into t1 values (20010203040506);
insert into t1 values (19800203040506);
@@ -3997,7 +3997,7 @@ hex(a)
0000000000000001
drop table t1;
drop view v1;
create table t1 (a timestamp);
create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
insert into t1 values (0);
insert into t1 values (20010203040506);
insert into t1 values (19800203040506);
@@ -5340,7 +5340,7 @@ Warning 1292 Truncated incorrect INTEGER value: ''
CREATE TABLE t1 (a DECIMAL(2,0));
SET sql_mode='strict_all_tables';
INSERT INTO t1 VALUES (CONVERT('9e99999999' USING ucs2));
ERROR 22007: Incorrect decimal value: '9e99999999' for column 'a' at row 1
ERROR 22003: Out of range value for column 'a' at row 1
SET sql_mode=DEFAULT;
INSERT INTO t1 VALUES (CONVERT('aaa' USING ucs2));
Warnings:
@@ -5627,5 +5627,18 @@ a
1
DROP TABLE t1;
#
# MDEV-8253 EXPLAIN SELECT prints unexpected characters
#
SET NAMES latin1, character_set_connection=ucs2;
CREATE TABLE t1 (a DECIMAL(10,1),b DECIMAL(10,1),c VARCHAR(10),d VARCHAR(10));
INSERT INTO t1 VALUES (1.5,1.5,'1','1'),(3.5,3.5,'3','3');
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE COALESCE(c,0)='3 ' AND COALESCE(d,0)=COALESCE(c,0);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d` from `test`.`t1` where ((coalesce(`test`.`t1`.`c`,0) = '3 ') and (coalesce(`test`.`t1`.`d`,0) = '3 '))
DROP TABLE t1;
#
# End of 10.1 tests
#

View File

@@ -1254,6 +1254,8 @@ insert into t1 values ('-1234.1e2xxxx');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
insert into t1 values ('-1234.1e2 ');
Warnings:
Note 1265 Data truncated for column 'a' at row 1
select * from t1;
a
-123410
@@ -1262,6 +1264,8 @@ a
drop table t1;
create table t1 (a int);
insert into t1 values ('1 ');
Warnings:
Note 1265 Data truncated for column 'a' at row 1
insert into t1 values ('1 x');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1

View File

@@ -1474,6 +1474,8 @@ INSERT INTO t1 VALUES ('-1234.1e2xxxx');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
INSERT INTO t1 VALUES ('-1234.1e2 ');
Warnings:
Note 1265 Data truncated for column 'a' at row 1
INSERT INTO t1 VALUES ('123');
INSERT INTO t1 VALUES ('-124');
INSERT INTO t1 VALUES ('+125');
@@ -1520,6 +1522,8 @@ DROP TABLE t1;
#
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES ('1 ');
Warnings:
Note 1265 Data truncated for column 'a' at row 1
INSERT INTO t1 VALUES ('1 x');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1

View File

@@ -1252,6 +1252,8 @@ insert into t1 values ('-1234.1e2xxxx');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
insert into t1 values ('-1234.1e2 ');
Warnings:
Note 1265 Data truncated for column 'a' at row 1
select * from t1;
a
-123410
@@ -1260,6 +1262,8 @@ a
drop table t1;
create table t1 (a int);
insert into t1 values ('1 ');
Warnings:
Note 1265 Data truncated for column 'a' at row 1
insert into t1 values ('1 x');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1

View File

@@ -4527,7 +4527,7 @@ t2 CREATE TABLE `t2` (
`concat(a)` varbinary(64) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
create table t1 (a timestamp);
create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
insert into t1 values (0);
insert into t1 values (20010203040506);
insert into t1 values (19800203040506);
@@ -4839,7 +4839,7 @@ hex(a)
0000000000000001
drop table t1;
drop view v1;
create table t1 (a timestamp);
create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
insert into t1 values (0);
insert into t1 values (20010203040506);
insert into t1 values (19800203040506);
@@ -10174,12 +10174,18 @@ INSERT INTO t1 VALUES ('1e1'),('1ë1');
SELECT * FROM t1 WHERE a IN (1,2);
a
1ë1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '1ë1'
SELECT * FROM t1 WHERE a IN (1,2) AND a='1ë1';
a
1ë1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '1ë1'
SELECT * FROM t1 WHERE a IN (1,2,'x') AND a='1ë1';
a
1ë1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '1ë1'
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2) AND a='1ë1';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
@@ -10192,5 +10198,20 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '1ë1') and (`test`.`t1`.`a` in (1,2,'x')))
DROP TABLE IF EXISTS t1;
#
# MDEV-8816 Equal field propagation is not applied for WHERE varbinary_column>=_utf8'a' COLLATE utf8_swedish_ci AND varbinary_column='A';
#
CREATE TABLE t1 (c VARBINARY(10));
INSERT INTO t1 VALUES ('a'),('A');
SELECT * FROM t1 WHERE c>=_utf8'a' COLLATE utf8_general_ci AND c='A';
c
A
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE c>=_utf8'a' COLLATE utf8_general_ci AND c='A';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`c` AS `c` from `test`.`t1` where (`test`.`t1`.`c` = 'A')
DROP TABLE t1;
#
# End of 10.1 tests
#

View File

@@ -122,3 +122,33 @@ DROP TABLE t1;
set global sql_mode=default;
SET SESSION enforce_storage_engine=NULL;
SET GLOBAL enforce_storage_engine=NULL;
CREATE TABLE t3 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=MyISAM;
INSERT INTO t3 values (NULL, 'test');
SET SESSION enforce_storage_engine=Memory;
ALTER TABLE t3 ENGINE=MyISAM;
Warnings:
Note 1266 Using storage engine MEMORY for table 't3'
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
DROP TABLE t3;
SET SESSION enforce_storage_engine=NULL;
CREATE TABLE t3 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=MyISAM;
INSERT INTO t3 values (NULL, 'test');
SET SESSION enforce_storage_engine=Memory;
ALTER TABLE t3 ADD COLUMN c3 INT;
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
`c3` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
DROP TABLE t3;
SET SESSION enforce_storage_engine=NULL;
SET GLOBAL enforce_storage_engine=NULL;

View File

@@ -799,6 +799,7 @@ EXPLAIN
{
"query_block": {
"select_id": 2,
"having_condition": "trigcond(<is_not_null_test>(t1.a))",
"full-scan-on-null_key": {
"table": {
"table_name": "t1",
@@ -1110,3 +1111,435 @@ EXPLAIN
}
}
DROP TABLE t1;
#
# MDEV-7970: EXPLAIN FORMAT=JSON does not print HAVING
#
create table t0(a int);
insert into t0 values (0),(1),(2),(3);
create table t1(a int);
insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
create table t2 (
a int,
b int,
key (a)
);
insert into t2 select A.a*1000 + B.a, A.a*1000 + B.a from t0 A, t1 B;
# normal HAVING
explain format=json select a, max(b) as TOP from t2 group by a having TOP > a;
EXPLAIN
{
"query_block": {
"select_id": 1,
"having_condition": "(TOP > t2.a)",
"filesort": {
"temporary_table": {
"function": "buffer",
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 256,
"filtered": 100
}
}
}
}
}
# HAVING is always TRUE (not printed)
explain format=json select a, max(b) as TOP from t2 group by a having 1<>2;
EXPLAIN
{
"query_block": {
"select_id": 1,
"filesort": {
"temporary_table": {
"function": "buffer",
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 256,
"filtered": 100
}
}
}
}
}
# HAVING is always FALSE (intercepted by message)
explain format=json select a, max(b) as TOP from t2 group by a having 1=2;
EXPLAIN
{
"query_block": {
"select_id": 1,
"table": {
"message": "Impossible HAVING"
}
}
}
# HAVING is absent
explain format=json select a, max(b) as TOP from t2 group by a;
EXPLAIN
{
"query_block": {
"select_id": 1,
"filesort": {
"temporary_table": {
"function": "buffer",
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 256,
"filtered": 100
}
}
}
}
}
drop table t0, t1, t2;
#
# MDEV-8829: Assertion `0' failed in Explain_table_access::tag_to_json
#
# Check ET_CONST_ROW_NOT_FOUND
create table t1 (i int) engine=myisam;
explain
select * from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found
explain format=json
select * from t1;
EXPLAIN
{
"query_block": {
"select_id": 1,
"table": {
"table_name": "t1",
"access_type": "system",
"rows": 0,
"filtered": 0,
"const_row_not_found": true
}
}
}
analyze format=json
select * from t1;
ANALYZE
{
"query_block": {
"select_id": 1,
"table": {
"message": "no matching row in const table"
}
}
}
drop table t1;
# Check ET_IMPOSSIBLE_ON_CONDITION
create table t1 (a int);
create table t2 (pk int primary key);
insert into t1 values (1),(2);
insert into t2 values (1),(2);
explain
select * from t1 left join t2 on t2.pk > 10 and t2.pk < 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 const PRIMARY NULL NULL NULL 1 Impossible ON condition
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
explain format=json
select * from t1 left join t2 on t2.pk > 10 and t2.pk < 0;
EXPLAIN
{
"query_block": {
"select_id": 1,
"const_condition": "1",
"table": {
"table_name": "t2",
"access_type": "const",
"possible_keys": ["PRIMARY"],
"rows": 1,
"filtered": 100,
"impossible_on_condition": true
},
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 2,
"filtered": 100
}
}
}
analyze format=json
select * from t1 left join t2 on t2.pk > 10 and t2.pk < 0;
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"const_condition": "1",
"table": {
"table_name": "t2",
"access_type": "const",
"possible_keys": ["PRIMARY"],
"r_loops": 0,
"rows": 1,
"r_rows": null,
"filtered": 100,
"r_filtered": null,
"impossible_on_condition": true
},
"table": {
"table_name": "t1",
"access_type": "ALL",
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100
}
}
}
# Check ET_NOT_EXISTS:
explain
select * from t1 left join t2 on t2.pk=t1.a where t2.pk is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where; Using index; Not exists
explain format=json
select * from t1 left join t2 on t2.pk=t1.a where t2.pk is null;
EXPLAIN
{
"query_block": {
"select_id": 1,
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 2,
"filtered": 100
},
"table": {
"table_name": "t2",
"access_type": "eq_ref",
"possible_keys": ["PRIMARY"],
"key": "PRIMARY",
"key_length": "4",
"used_key_parts": ["pk"],
"ref": ["test.t1.a"],
"rows": 1,
"filtered": 100,
"attached_condition": "(trigcond(isnull(t2.pk)) and trigcond(trigcond((t1.a is not null))))",
"using_index": true,
"not_exists": true
}
}
}
analyze format=json
select * from t1 left join t2 on t2.pk=t1.a where t2.pk is null;
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t1",
"access_type": "ALL",
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100
},
"table": {
"table_name": "t2",
"access_type": "eq_ref",
"possible_keys": ["PRIMARY"],
"key": "PRIMARY",
"key_length": "4",
"used_key_parts": ["pk"],
"ref": ["test.t1.a"],
"r_loops": 2,
"rows": 1,
"r_rows": 1,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100,
"attached_condition": "(trigcond(isnull(t2.pk)) and trigcond(trigcond((t1.a is not null))))",
"using_index": true,
"not_exists": true
}
}
}
# Check ET_DISTINCT
explain
select distinct t1.a from t1 join t2 on t2.pk=t1.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where; Using temporary
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index; Distinct
explain format=json
select distinct t1.a from t1 join t2 on t2.pk=t1.a;
EXPLAIN
{
"query_block": {
"select_id": 1,
"temporary_table": {
"function": "buffer",
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 2,
"filtered": 100,
"attached_condition": "(t1.a is not null)"
},
"table": {
"table_name": "t2",
"access_type": "eq_ref",
"possible_keys": ["PRIMARY"],
"key": "PRIMARY",
"key_length": "4",
"used_key_parts": ["pk"],
"ref": ["test.t1.a"],
"rows": 1,
"filtered": 100,
"using_index": true,
"distinct": true
}
}
}
}
analyze format=json
select distinct t1.a from t1 join t2 on t2.pk=t1.a;
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"temporary_table": {
"table": {
"table_name": "t1",
"access_type": "ALL",
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100,
"attached_condition": "(t1.a is not null)"
},
"table": {
"table_name": "t2",
"access_type": "eq_ref",
"possible_keys": ["PRIMARY"],
"key": "PRIMARY",
"key_length": "4",
"used_key_parts": ["pk"],
"ref": ["test.t1.a"],
"r_loops": 2,
"rows": 1,
"r_rows": 1,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100,
"using_index": true,
"distinct": true
}
}
}
}
drop table t1,t2;
# Check ET_USING_INDEX_CONDITION_BKA
create table t1(a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t2(a int);
insert into t2 select A.a + B.a* 10 + C.a * 100 from t1 A, t1 B, t1 C;
create table t3(a int, b int);
insert into t3 select a,a from t1;
create table t4(a int, b int, c int, filler char(100), key (a,b));
insert into t4 select a,a,a, 'filler-data' from t2;
set @tmp_optimizer_switch=@@optimizer_switch;
set @tmp_join_cache_level=@@join_cache_level;
set optimizer_switch='mrr=on';
set join_cache_level=6;
explain
select * from t3,t4 where t3.a=t4.a and (t4.b+1 <= t3.b+1);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 ALL NULL NULL NULL NULL 10 Using where
1 SIMPLE t4 ref a a 5 test.t3.a 1 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan
explain format=json
select * from t3,t4 where t3.a=t4.a and (t4.b+1 <= t3.b+1);
EXPLAIN
{
"query_block": {
"select_id": 1,
"table": {
"table_name": "t3",
"access_type": "ALL",
"rows": 10,
"filtered": 100,
"attached_condition": "(t3.a is not null)"
},
"block-nl-join": {
"table": {
"table_name": "t4",
"access_type": "ref",
"possible_keys": ["a"],
"key": "a",
"key_length": "5",
"used_key_parts": ["a"],
"ref": ["test.t3.a"],
"rows": 1,
"filtered": 100,
"index_condition_bka": "((t4.b + 1) <= (t3.b + 1))"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"join_type": "BKA",
"mrr_type": "Rowid-ordered scan"
}
}
}
analyze format=json
select * from t3,t4 where t3.a=t4.a and (t4.b+1 <= t3.b+1);
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t3",
"access_type": "ALL",
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100,
"attached_condition": "(t3.a is not null)"
},
"block-nl-join": {
"table": {
"table_name": "t4",
"access_type": "ref",
"possible_keys": ["a"],
"key": "a",
"key_length": "5",
"used_key_parts": ["a"],
"ref": ["test.t3.a"],
"r_loops": 0,
"rows": 1,
"r_rows": null,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": null,
"index_condition_bka": "((t4.b + 1) <= (t3.b + 1))"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"join_type": "BKA",
"mrr_type": "Rowid-ordered scan",
"r_filtered": 100
}
}
}
set optimizer_switch=@tmp_optimizer_switch;
set join_cache_level=@tmp_join_cache_level;
drop table t1,t2,t3,t4;

View File

@@ -73,6 +73,9 @@ set @@global.max_allowed_packet=1048576*100;
select compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null;
compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null
0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: XXX
Warning 1292 Truncated incorrect DOUBLE value: XXX
set @@global.max_allowed_packet=default;
create table t1(a blob);
insert into t1 values(NULL), (compress('a'));

View File

@@ -476,8 +476,13 @@ CREATE TABLE t1(f1 LONGTEXT) engine=myisam;
INSERT INTO t1 VALUES ('a');
SELECT 1 FROM (SELECT ROUND(f1) AS a FROM t1) AS s WHERE a LIKE 'a';
1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
SELECT 1 FROM (SELECT ROUND(f1, f1) AS a FROM t1) AS s WHERE a LIKE 'a';
1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect INTEGER value: 'a'
DROP TABLE t1;
End of 5.0 tests
SELECT 1e308 + 1e308;

View File

@@ -172,8 +172,8 @@ INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 )
8
8
Warnings:
Warning 1292 Incorrect datetime value: '10'
Warning 1292 Incorrect datetime value: '11'
Warning 1292 Incorrect datetime value: '10' for column 'pk' at row 1
Warning 1292 Incorrect datetime value: '11' for column 'pk' at row 2
DROP TABLE t1;
#
# End of 5.3 tests
@@ -233,8 +233,8 @@ INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 )
8
8
Warnings:
Warning 1292 Incorrect datetime value: '10'
Warning 1292 Incorrect datetime value: '11'
Warning 1292 Incorrect datetime value: '10' for column 'pk' at row 1
Warning 1292 Incorrect datetime value: '11' for column 'pk' at row 2
DROP TABLE t1;
#
# End of 5.3 tests

View File

@@ -2893,6 +2893,8 @@ NULL
SELECT ((127.1) not in ((rpad(1.0,2048,1)),(''),(-1.1)));
((127.1) not in ((rpad(1.0,2048,1)),(''),(-1.1)))
1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
SELECT ((0xf3) * (rpad(1.0,2048,1)) << (0xcc));
((0xf3) * (rpad(1.0,2048,1)) << (0xcc))
0

View File

@@ -1714,6 +1714,7 @@ min(timestampadd(month, 1>'', from_days('%Z')))
NULL
Warnings:
Warning 1292 Truncated incorrect INTEGER value: '%Z'
Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Incorrect datetime value: '0000-00-00'
create table t1(a time);
insert into t1 values ('00:00:00'),('00:01:00');
@@ -1823,8 +1824,6 @@ create table t1 (f1 datetime, key (f1));
insert into t1 values ('2000-09-12 00:00:00'), ('2007-04-25 05:08:49');
select * from t1 where f1 > time('-23:00:06');
f1
2000-09-12 00:00:00
2007-04-25 05:08:49
drop table t1;
select maketime(20,61,10)+0;
maketime(20,61,10)+0
@@ -1835,25 +1834,14 @@ select last_day(f2) from t1;
last_day(f2)
NULL
NULL
Warnings:
Warning 1292 Incorrect datetime value: '0'
Warning 1292 Incorrect datetime value: '0'
select last_day(f2) from t1 where last_day(f2) is null;
last_day(f2)
NULL
NULL
Warnings:
Warning 1292 Incorrect datetime value: '0'
Warning 1292 Incorrect datetime value: '0'
Warning 1292 Incorrect datetime value: '0'
Warning 1292 Incorrect datetime value: '0'
select * from t1 order by last_day (f2);
f2
0
0
Warnings:
Warning 1292 Incorrect datetime value: '0'
Warning 1292 Incorrect datetime value: '0'
drop table t1;
SET timestamp=unix_timestamp('2001-02-03 10:20:30');
select convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)), 'UTC', 'Europe/Moscow');
@@ -1909,8 +1897,6 @@ insert ignore t1 values ('04:38:11','0000-00-00 00:00:00',0,'0000-00-00 00:00:00
select least(greatest(f3, f2, f4), f5) from t1;
least(greatest(f3, f2, f4), f5)
0000-00-00 00:00:00
Warnings:
Warning 1292 Incorrect datetime value: '0'
drop table t1;
select day(coalesce(null));
day(coalesce(null))

View File

@@ -267,6 +267,8 @@ POLYGON
# Bug#13358363 - ASSERTION: N > 0 && N < SINUSES_CALCULATED*2+1 | GET_N_SINCOS/ADD_EDGE_BUFFER
#
DO ST_BUFFER(ST_GEOMCOLLFROMTEXT('linestring(1 1,2 2)'),'');
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
SELECT ST_WITHIN(
LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '),
ST_BUFFER(MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5))) '),

View File

@@ -754,6 +754,8 @@ POLYGON
# Bug#13358363 - ASSERTION: N > 0 && N < SINUSES_CALCULATED*2+1 | GET_N_SINCOS/ADD_EDGE_BUFFER
#
DO ST_BUFFER(ST_GEOMCOLLFROMTEXT('linestring(1 1,2 2)'),'');
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
SELECT ST_WITHIN(
LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '),
ST_BUFFER(MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5))) '),

View File

@@ -1816,3 +1816,15 @@ disjoint
select ST_IsRing(NULL);
ST_IsRing(NULL)
-1
#
# MDEV-8675 Different results of GIS functions on NULL vs NOT NULL columns
#
CREATE TABLE t1 (g1 GEOMETRY NOT NULL,g2 GEOMETRY NULL);
CREATE TABLE t2 AS SELECT WITHIN(g1,g1) as w1,WITHIN(g2,g2) AS w2 FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`w1` int(1) DEFAULT NULL,
`w2` int(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2;

View File

@@ -0,0 +1,7 @@
#
# MDEV-6756: map a linux pid (child pid) to a connection id shown in
# the output of SHOW PROCESSLIST
#
SELECT max(tid) != min(tid) FROM information_schema.processlist;
max(tid) != min(tid)
1

View File

@@ -20,7 +20,7 @@ insert into t1 values (0,"mysql a");
insert into t1 values (0,"r1manic");
insert into t1 values (0,"r1man");
drop table t1;
create table t1 (a int not null auto_increment, primary key (a), t timestamp, c char(10) default "hello", i int);
create table t1 (a int not null auto_increment, primary key (a), t timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c char(10) default "hello", i int);
insert into t1 values (default,default,default,default), (default,default,default,default), (4,0,"a",5),(default,default,default,default);
select a,t>0,c,i from t1;
a t>0 c i
@@ -92,14 +92,14 @@ create table t1(number int auto_increment primary key, original_value varchar(50
set @value= "aa";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
Warning 1265 Data truncated for column 'f_double' at row 1
Warning 1265 Data truncated for column 'f_float' at row 1
Warning 1265 Data truncated for column 'f_double_7_2' at row 1
Warning 1265 Data truncated for column 'f_float_4_3' at row 1
Warning 1265 Data truncated for column 'f_double_u' at row 1
Warning 1265 Data truncated for column 'f_float_u' at row 1
Warning 1265 Data truncated for column 'f_double_15_1_u' at row 1
Warning 1265 Data truncated for column 'f_float_3_1_u' at row 1
Warning 1366 Incorrect double value: 'aa' for column 'f_double' at row 1
Warning 1366 Incorrect double value: 'aa' for column 'f_float' at row 1
Warning 1366 Incorrect double value: 'aa' for column 'f_double_7_2' at row 1
Warning 1366 Incorrect double value: 'aa' for column 'f_float_4_3' at row 1
Warning 1366 Incorrect double value: 'aa' for column 'f_double_u' at row 1
Warning 1366 Incorrect double value: 'aa' for column 'f_float_u' at row 1
Warning 1366 Incorrect double value: 'aa' for column 'f_double_15_1_u' at row 1
Warning 1366 Incorrect double value: 'aa' for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id();
number 1
original_value aa
@@ -136,14 +136,14 @@ f_float_3_1_u 1.0
set @value= "aa1";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
Warning 1265 Data truncated for column 'f_double' at row 1
Warning 1265 Data truncated for column 'f_float' at row 1
Warning 1265 Data truncated for column 'f_double_7_2' at row 1
Warning 1265 Data truncated for column 'f_float_4_3' at row 1
Warning 1265 Data truncated for column 'f_double_u' at row 1
Warning 1265 Data truncated for column 'f_float_u' at row 1
Warning 1265 Data truncated for column 'f_double_15_1_u' at row 1
Warning 1265 Data truncated for column 'f_float_3_1_u' at row 1
Warning 1366 Incorrect double value: 'aa1' for column 'f_double' at row 1
Warning 1366 Incorrect double value: 'aa1' for column 'f_float' at row 1
Warning 1366 Incorrect double value: 'aa1' for column 'f_double_7_2' at row 1
Warning 1366 Incorrect double value: 'aa1' for column 'f_float_4_3' at row 1
Warning 1366 Incorrect double value: 'aa1' for column 'f_double_u' at row 1
Warning 1366 Incorrect double value: 'aa1' for column 'f_float_u' at row 1
Warning 1366 Incorrect double value: 'aa1' for column 'f_double_15_1_u' at row 1
Warning 1366 Incorrect double value: 'aa1' for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id();
number 3
original_value aa1

View File

@@ -418,7 +418,7 @@ create table t1 (
c1 int,
c2 char(12),
c3 varchar(123),
c4 timestamp,
c4 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
index (c1),
index i1 (c1),
index i2 (c2),

View File

@@ -43,8 +43,11 @@ drop table t1;
create table t1 (a int, b char(10));
load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
Warnings:
Note 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 2
Warning 1366 Incorrect integer value: 'error ' for column 'a' at row 3
Warning 1262 Row 3 was truncated; it contained more data than there were input columns
Note 1265 Data truncated for column 'a' at row 4
Warning 1366 Incorrect integer value: 'wrong end ' for column 'a' at row 5
Warning 1262 Row 5 was truncated; it contained more data than there were input columns
select * from t1;
@@ -57,6 +60,9 @@ a b
truncate table t1;
load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
Warnings:
Note 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 2
Note 1265 Data truncated for column 'a' at row 3
Warning 1366 Incorrect integer value: '
' for column 'a' at row 4
Warning 1261 Row 4 doesn't contain data for all columns
@@ -73,6 +79,8 @@ insert into t1 values(0);
select * from t1;
id
0
Warnings:
Note 1265 Data truncated for column 'id' at row 1
select * from t1;
id
0
@@ -180,6 +188,13 @@ NULL 10 10
NULL 15 15
truncate table t1;
load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c="Wow";
Warnings:
Note 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'b' at row 1
Note 1265 Data truncated for column 'a' at row 2
Note 1265 Data truncated for column 'b' at row 2
Note 1265 Data truncated for column 'a' at row 3
Note 1265 Data truncated for column 'b' at row 3
select * from t1;
a b c
1 2 Wow
@@ -187,6 +202,13 @@ a b c
5 6 Wow
truncate table t1;
load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c=concat(a,"+",b,"+",@c,"+",b,"+",if(c is null,"NIL",c));
Warnings:
Note 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'b' at row 1
Note 1265 Data truncated for column 'a' at row 2
Note 1265 Data truncated for column 'b' at row 2
Note 1265 Data truncated for column 'a' at row 3
Note 1265 Data truncated for column 'b' at row 3
select * from t1;
a b c
1 2 1+2+123+2+NIL
@@ -234,7 +256,9 @@ f1
2
delete from t1;
Warnings:
Note 1265 Data truncated for column 'f1' at row 1
Warning 1261 Row 1 doesn't contain data for all columns
Note 1265 Data truncated for column 'f1' at row 2
Warning 1261 Row 2 doesn't contain data for all columns
select f1 from t1 where f2 <> '0000-00-00 00:00:00' order by f1;
f1

View File

@@ -8,7 +8,7 @@ def hello 253 5 5 N 1 31 8
def NULL 6 0 0 Y 32896 0 63
1 1.0 -1 hello NULL
1 1.0 -1 hello NULL
create table t1 (a tinyint, b smallint, c mediumint, d int, e bigint, f float(3,2), g double(4,3), h decimal(5,4), i year, j date, k timestamp, l datetime, m enum('a','b'), n set('a','b'), o char(10));
create table t1 (a tinyint, b smallint, c mediumint, d int, e bigint, f float(3,2), g double(4,3), h decimal(5,4), i year, j date, k timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, l datetime, m enum('a','b'), n set('a','b'), o char(10));
select * from t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 t1 a a 1 4 0 Y 32768 0 63
@@ -239,7 +239,7 @@ dcol_uns double unsigned,
# date/time types
date_col date,
time_col time,
timestamp_col timestamp,
timestamp_col timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
year_col year,
datetime_col datetime,
# string types

View File

@@ -608,7 +608,7 @@ update t1 set sca_pic="test" where sca_pic is null;
delete from t1 where sca_code='pd';
drop table t1;
set @a:=now();
CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=MyISAM;
CREATE TABLE t1 (a int not null, b timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, primary key (a)) engine=MyISAM;
insert into t1 (a) values(1),(2),(3);
select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a;
a
@@ -843,9 +843,9 @@ number bigint(20) NOT NULL default '0',
cname char(15) NOT NULL default '',
carrier_id smallint(6) NOT NULL default '0',
privacy tinyint(4) NOT NULL default '0',
last_mod_date timestamp NOT NULL,
last_mod_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
last_mod_id smallint(6) NOT NULL default '0',
last_app_date timestamp NOT NULL,
last_app_date timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
last_app_id smallint(6) default '-1',
version smallint(6) NOT NULL default '0',
assigned_scps int(11) default '0',
@@ -862,9 +862,9 @@ number bigint(20) NOT NULL default '0',
cname char(15) NOT NULL default '',
carrier_id smallint(6) NOT NULL default '0',
privacy tinyint(4) NOT NULL default '0',
last_mod_date timestamp NOT NULL,
last_mod_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
last_mod_id smallint(6) NOT NULL default '0',
last_app_date timestamp NOT NULL,
last_app_date timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
last_app_id smallint(6) default '-1',
version smallint(6) NOT NULL default '0',
assigned_scps int(11) default '0',

View File

@@ -181,8 +181,8 @@ ERROR HY000: You are using safe update mode and you tried to update a table with
set sql_safe_updates=0;
drop table t1,t2;
set timestamp=1038401397;
create table t1 (n int(10) not null primary key, d int(10), t timestamp);
create table t2 (n int(10) not null primary key, d int(10), t timestamp);
create table t1 (n int(10) not null primary key, d int(10), t timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
create table t2 (n int(10) not null primary key, d int(10), t timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
insert into t1 values(1,1,NULL);
insert into t2 values(1,10,NULL),(2,20,NULL);
set timestamp=1038000000;

View File

@@ -459,4 +459,64 @@ even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@loca
DROP USER very_long_user_name_number_1, very_long_user_name_number_2, even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@localhost;
DROP PROCEDURE test.pr;
set sql_mode=default;
# Droping the previously created mysql_upgrade_info file..
create table test.t1(a int) engine=MyISAM;
# Trying to enforce InnoDB for all tables
SET GLOBAL enforce_storage_engine=InnoDB;
Phase 1/6: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.index_stats OK
mysql.innodb_index_stats OK
mysql.innodb_table_stats OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.roles_mapping OK
mysql.servers OK
mysql.table_stats OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Phase 2/6: Fixing views
Phase 3/6: Running 'mysql_fix_privilege_tables'
Phase 4/6: Fixing table and database names
Phase 5/6: Checking and upgrading tables
Processing databases
information_schema
mtr
mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
test.t1 OK
Phase 6/6: Running 'FLUSH PRIVILEGES'
OK
# Should return 2
SELECT count(*) FROM information_schema.tables where ENGINE="InnoDB";
count(*)
2
SHOW CREATE TABLE test.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE test.t1;
SET GLOBAL enforce_storage_engine=NULL;
End of tests

View File

@@ -197,6 +197,11 @@ The following options may be given as the first argument:
If non-zero, binary logs will be purged after
expire_logs_days days; possible purges happen at startup
and at binary log rotation
--explicit-defaults-for-timestamp
This option causes CREATE TABLE to create all TIMESTAMP
columns as NULL with DEFAULT NULL attribute, Without this
option, TIMESTAMP columns are NOT NULL and have implicit
DEFAULT clauses. The old behavior is deprecated.
--external-locking Use system (external) locking (disabled by default).
With this option enabled you can run myisamchk to test
(not repair) tables while the MySQL server is running.
@@ -1179,6 +1184,7 @@ enforce-storage-engine (No default value)
event-scheduler OFF
expensive-subquery-limit 100
expire-logs-days 0
explicit-defaults-for-timestamp FALSE
external-locking FALSE
extra-max-connections 1
extra-port 0

View File

@@ -2891,7 +2891,7 @@ drop table t1;
# Bug#13052 mysqldump timestamp reloads broken
#
drop table if exists t1;
create table t1 (`d` timestamp, unique (`d`));
create table t1 (`d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, unique (`d`));
set time_zone='+00:00';
insert into t1 values ('2003-10-25 22:00:00'),('2003-10-25 23:00:00');
select * from t1;

View File

@@ -17,7 +17,8 @@ create table t9
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
c13 date, c14 datetime, c15 timestamp, c16 time,
c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP, c16 time,
c17 year, c18 tinyint, c19 bool, c20 char,
c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
c25 blob, c26 text, c27 mediumblob, c28 mediumtext,

View File

@@ -10,7 +10,8 @@ create table t9
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
c13 date, c14 datetime, c15 timestamp, c16 time,
c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP, c16 time,
c17 year, c18 tinyint, c19 bool, c20 char,
c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
c25 blob, c26 text, c27 mediumblob, c28 mediumtext,

View File

@@ -10,7 +10,8 @@ create table t9
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
c13 date, c14 datetime, c15 timestamp, c16 time,
c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP, c16 time,
c17 year, c18 tinyint, c19 bool, c20 char,
c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
c25 blob, c26 text, c27 mediumblob, c28 mediumtext,

View File

@@ -11,7 +11,8 @@ create table t9
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
c13 date, c14 datetime, c15 timestamp, c16 time,
c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP, c16 time,
c17 year, c18 tinyint, c19 bool, c20 char,
c21 char(10), c22 varchar(30), c23 varchar(100), c24 varchar(100),
c25 varchar(100), c26 varchar(100), c27 varchar(100), c28 varchar(100),

View File

@@ -12,7 +12,8 @@ create table t9
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
c13 date, c14 datetime, c15 timestamp, c16 time,
c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP, c16 time,
c17 year, c18 tinyint, c19 bool, c20 char,
c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
@@ -32,7 +33,8 @@ create table t9
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
c13 date, c14 datetime, c15 timestamp, c16 time,
c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP, c16 time,
c17 year, c18 tinyint, c19 bool, c20 char,
c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
@@ -52,7 +54,7 @@ create table t9
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
c13 date, c14 datetime, c15 timestamp, c16 time,
c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c16 time,
c17 year, c18 tinyint, c19 bool, c20 char,
c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
@@ -3406,7 +3408,7 @@ create table t9
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
c13 date, c14 datetime, c15 timestamp, c16 time,
c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c16 time,
c17 year, c18 tinyint, c19 bool, c20 char,
c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
c25 blob, c26 text, c27 mediumblob, c28 mediumtext,

View File

@@ -2111,7 +2111,7 @@ INSERT INTO t1 (pseudo) VALUES ('test1');
SELECT 1 as rnd1 from t1 where rand() > 2;
rnd1
DROP TABLE t1;
CREATE TABLE t1 (gvid int(10) unsigned default NULL, hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, mmid int(10) unsigned default NULL, hdid int(10) unsigned default NULL, fsid int(10) unsigned default NULL, ctid int(10) unsigned default NULL, dtid int(10) unsigned default NULL, cost int(10) unsigned default NULL, performance int(10) unsigned default NULL, serialnumber bigint(20) unsigned default NULL, monitored tinyint(3) unsigned default '1', removed tinyint(3) unsigned default '0', target tinyint(3) unsigned default '0', dt_modified timestamp NOT NULL, name varchar(255) binary default NULL, description varchar(255) default NULL, UNIQUE KEY hmid (hmid,volid)) ENGINE=MyISAM;
CREATE TABLE t1 (gvid int(10) unsigned default NULL, hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, mmid int(10) unsigned default NULL, hdid int(10) unsigned default NULL, fsid int(10) unsigned default NULL, ctid int(10) unsigned default NULL, dtid int(10) unsigned default NULL, cost int(10) unsigned default NULL, performance int(10) unsigned default NULL, serialnumber bigint(20) unsigned default NULL, monitored tinyint(3) unsigned default '1', removed tinyint(3) unsigned default '0', target tinyint(3) unsigned default '0', dt_modified timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, name varchar(255) binary default NULL, description varchar(255) default NULL, UNIQUE KEY hmid (hmid,volid)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (200001,2,1,1,100,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\E$',''),(200002,2,2,1,101,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\C$',''),(200003,1,3,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,0,1,20020425060427,'c:',NULL);
CREATE TABLE t2 ( hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, sampletid smallint(5) unsigned default NULL, sampletime datetime default NULL, samplevalue bigint(20) unsigned default NULL, KEY idx1 (hmid,volid,sampletid,sampletime)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12:00:01',35);
@@ -3742,7 +3742,7 @@ WHERE ID_better=1 AND ID1_with_null IS NULL AND
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref idx1,idx2 idx2 4 const 1 Using where
DROP TABLE t1;
CREATE TABLE t1 (a INT, ts TIMESTAMP, KEY ts(ts));
CREATE TABLE t1 (a INT, ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, KEY ts(ts));
INSERT INTO t1 VALUES (30,"2006-01-03 23:00:00"), (31,"2006-01-03 23:00:00");
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
@@ -4482,7 +4482,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1003 select '2001-01-01' AS `a` from dual where 1
DROP TABLE t1;
CREATE TABLE t1(a TIMESTAMP NOT NULL);
CREATE TABLE t1(a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
INSERT INTO t1 VALUES('2001-01-01');
SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00';
a

View File

@@ -2122,7 +2122,7 @@ INSERT INTO t1 (pseudo) VALUES ('test1');
SELECT 1 as rnd1 from t1 where rand() > 2;
rnd1
DROP TABLE t1;
CREATE TABLE t1 (gvid int(10) unsigned default NULL, hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, mmid int(10) unsigned default NULL, hdid int(10) unsigned default NULL, fsid int(10) unsigned default NULL, ctid int(10) unsigned default NULL, dtid int(10) unsigned default NULL, cost int(10) unsigned default NULL, performance int(10) unsigned default NULL, serialnumber bigint(20) unsigned default NULL, monitored tinyint(3) unsigned default '1', removed tinyint(3) unsigned default '0', target tinyint(3) unsigned default '0', dt_modified timestamp NOT NULL, name varchar(255) binary default NULL, description varchar(255) default NULL, UNIQUE KEY hmid (hmid,volid)) ENGINE=MyISAM;
CREATE TABLE t1 (gvid int(10) unsigned default NULL, hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, mmid int(10) unsigned default NULL, hdid int(10) unsigned default NULL, fsid int(10) unsigned default NULL, ctid int(10) unsigned default NULL, dtid int(10) unsigned default NULL, cost int(10) unsigned default NULL, performance int(10) unsigned default NULL, serialnumber bigint(20) unsigned default NULL, monitored tinyint(3) unsigned default '1', removed tinyint(3) unsigned default '0', target tinyint(3) unsigned default '0', dt_modified timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, name varchar(255) binary default NULL, description varchar(255) default NULL, UNIQUE KEY hmid (hmid,volid)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (200001,2,1,1,100,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\E$',''),(200002,2,2,1,101,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\C$',''),(200003,1,3,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,0,1,20020425060427,'c:',NULL);
CREATE TABLE t2 ( hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, sampletid smallint(5) unsigned default NULL, sampletime datetime default NULL, samplevalue bigint(20) unsigned default NULL, KEY idx1 (hmid,volid,sampletid,sampletime)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12:00:01',35);
@@ -3753,7 +3753,7 @@ WHERE ID_better=1 AND ID1_with_null IS NULL AND
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref idx1,idx2 idx2 4 const 1 Using where
DROP TABLE t1;
CREATE TABLE t1 (a INT, ts TIMESTAMP, KEY ts(ts));
CREATE TABLE t1 (a INT, ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, KEY ts(ts));
INSERT INTO t1 VALUES (30,"2006-01-03 23:00:00"), (31,"2006-01-03 23:00:00");
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
@@ -4493,7 +4493,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1003 select '2001-01-01' AS `a` from dual where 1
DROP TABLE t1;
CREATE TABLE t1(a TIMESTAMP NOT NULL);
CREATE TABLE t1(a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
INSERT INTO t1 VALUES('2001-01-01');
SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00';
a

View File

@@ -2111,7 +2111,7 @@ INSERT INTO t1 (pseudo) VALUES ('test1');
SELECT 1 as rnd1 from t1 where rand() > 2;
rnd1
DROP TABLE t1;
CREATE TABLE t1 (gvid int(10) unsigned default NULL, hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, mmid int(10) unsigned default NULL, hdid int(10) unsigned default NULL, fsid int(10) unsigned default NULL, ctid int(10) unsigned default NULL, dtid int(10) unsigned default NULL, cost int(10) unsigned default NULL, performance int(10) unsigned default NULL, serialnumber bigint(20) unsigned default NULL, monitored tinyint(3) unsigned default '1', removed tinyint(3) unsigned default '0', target tinyint(3) unsigned default '0', dt_modified timestamp NOT NULL, name varchar(255) binary default NULL, description varchar(255) default NULL, UNIQUE KEY hmid (hmid,volid)) ENGINE=MyISAM;
CREATE TABLE t1 (gvid int(10) unsigned default NULL, hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, mmid int(10) unsigned default NULL, hdid int(10) unsigned default NULL, fsid int(10) unsigned default NULL, ctid int(10) unsigned default NULL, dtid int(10) unsigned default NULL, cost int(10) unsigned default NULL, performance int(10) unsigned default NULL, serialnumber bigint(20) unsigned default NULL, monitored tinyint(3) unsigned default '1', removed tinyint(3) unsigned default '0', target tinyint(3) unsigned default '0', dt_modified timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, name varchar(255) binary default NULL, description varchar(255) default NULL, UNIQUE KEY hmid (hmid,volid)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (200001,2,1,1,100,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\E$',''),(200002,2,2,1,101,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\C$',''),(200003,1,3,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,0,1,20020425060427,'c:',NULL);
CREATE TABLE t2 ( hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, sampletid smallint(5) unsigned default NULL, sampletime datetime default NULL, samplevalue bigint(20) unsigned default NULL, KEY idx1 (hmid,volid,sampletid,sampletime)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12:00:01',35);
@@ -3742,7 +3742,7 @@ WHERE ID_better=1 AND ID1_with_null IS NULL AND
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref idx1,idx2 idx2 4 const 1 Using where
DROP TABLE t1;
CREATE TABLE t1 (a INT, ts TIMESTAMP, KEY ts(ts));
CREATE TABLE t1 (a INT, ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, KEY ts(ts));
INSERT INTO t1 VALUES (30,"2006-01-03 23:00:00"), (31,"2006-01-03 23:00:00");
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
@@ -4482,7 +4482,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1003 select '2001-01-01' AS `a` from dual where 1
DROP TABLE t1;
CREATE TABLE t1(a TIMESTAMP NOT NULL);
CREATE TABLE t1(a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
INSERT INTO t1 VALUES('2001-01-01');
SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00';
a

View File

@@ -277,6 +277,23 @@ Warnings:
Note 1003 select `test`.`ta`.`a` AS `a`,`test`.`tb`.`a` AS `a` from `test`.`t1` `ta` join `test`.`t2` `tb` where ((`test`.`tb`.`a` = `test`.`ta`.`a`) and (`test`.`ta`.`a` < 40) and (`test`.`ta`.`a` < 100))
drop table t0,t1,t2;
#
# MDEV-8779: mysqld got signal 11 in sql/opt_range_mrr.cc:100(step_down_to)
#
set @tmp_mdev8779=@@optimizer_use_condition_selectivity;
set optimizer_use_condition_selectivity=5;
CREATE TABLE t1 (
i int(10) unsigned NOT NULL AUTO_INCREMENT,
n varchar(2048) NOT NULL,
d tinyint(1) unsigned NOT NULL,
p int(10) unsigned NOT NULL,
PRIMARY KEY (i)
) DEFAULT CHARSET=utf8;
insert into t1 values (1,'aaa',1,1), (2,'bbb',2,2);
SELECT * FROM t1 WHERE t1.d = 0 AND t1.p = '1' AND t1.i != '-1' AND t1.n = 'some text';
i n d p
set optimizer_use_condition_selectivity= @tmp_mdev8779;
DROP TABLE t1;
#
# End of the test file
#
set use_stat_tables= @save_use_stat_tables;

View File

@@ -316,7 +316,7 @@ type_numeric numeric(5,2),
empty_char char(0),
type_char char(2),
type_varchar varchar(10),
type_timestamp timestamp not null,
type_timestamp timestamp not null default current_timestamp on update current_timestamp,
type_date date not null default '0000-00-00',
type_time time not null default '00:00:00',
type_datetime datetime not null default '0000-00-00 00:00:00',

View File

@@ -1758,7 +1758,7 @@ CAST('10 ' as unsigned integer)
CAST('10 ' as unsigned integer)
10
Warnings:
Warning 1292 Truncated incorrect INTEGER value: '10 '
Note 1292 Truncated incorrect INTEGER value: '10 '
DROP PROCEDURE p1;
DROP PROCEDURE p2;
@@ -1767,7 +1767,7 @@ DROP PROCEDURE p2;
CREATE PROCEDURE p1()
BEGIN
DECLARE c INT DEFAULT 0;
DECLARE CONTINUE HANDLER FOR SQLWARNING SET c = c + 1;
DECLARE CONTINUE HANDLER FOR SQLSTATE '22007' SET c = c + 1;
CALL p2();
CALL p3();
CALL p4();
@@ -1797,7 +1797,7 @@ END|
CREATE PROCEDURE P6()
BEGIN
DECLARE c INT DEFAULT 0;
DECLARE CONTINUE HANDLER FOR SQLWARNING SET c = c + 1;
DECLARE CONTINUE HANDLER FOR SQLSTATE '22007' SET c = c + 1;
CALL p5();
SELECT c;
END|
@@ -1821,7 +1821,7 @@ CALL p6();
CAST('10 ' as unsigned integer)
10
Level Code Message
Warning 1292 Truncated incorrect INTEGER value: '10 '
Note 1292 Truncated incorrect INTEGER value: '10 '
c
1
DROP PROCEDURE p1;
@@ -1982,9 +1982,9 @@ Level Code Message
Warning 1264 Out of range value for column 'x' at row 1
Warning 1264 Out of range value for column 'y' at row 1
Warning 1264 Out of range value for column 'z' at row 1
Warning 1292 Truncated incorrect INTEGER value: '111111 '
Note 1292 Truncated incorrect INTEGER value: '111111 '
Warning 1264 Out of range value for column 'a' at row 1
Warning 1292 Truncated incorrect INTEGER value: '222222 '
Note 1292 Truncated incorrect INTEGER value: '222222 '
Warning 1264 Out of range value for column 'b' at row 1
Error 1048 Column 'c' cannot be null
@@ -2744,14 +2744,14 @@ END|
CALL p6()|
Level Code Message
Warning 1292 Truncated incorrect INTEGER value: '1 '
Warning 1292 Truncated incorrect INTEGER value: '1999999 '
Note 1292 Truncated incorrect INTEGER value: '1 '
Note 1292 Truncated incorrect INTEGER value: '1999999 '
Warning 1264 Out of range value for column 'a' at row 1
Warning 1292 Truncated incorrect INTEGER value: '2 '
Warning 1292 Truncated incorrect INTEGER value: '2999999 '
Note 1292 Truncated incorrect INTEGER value: '2 '
Note 1292 Truncated incorrect INTEGER value: '2999999 '
Warning 1264 Out of range value for column 'b' at row 1
Warning 1292 Truncated incorrect INTEGER value: '3 '
Warning 1292 Truncated incorrect INTEGER value: '3999999 '
Note 1292 Truncated incorrect INTEGER value: '3 '
Note 1292 Truncated incorrect INTEGER value: '3999999 '
Warning 1264 Out of range value for column 'c' at row 1
Msg
Handler for 1292

View File

@@ -7102,7 +7102,7 @@ CAST('10 ' as UNSIGNED INTEGER)
1
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
Warning 1292 Truncated incorrect INTEGER value: '10 '
Note 1292 Truncated incorrect INTEGER value: '10 '
DROP PROCEDURE p1;
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p2;
@@ -7128,7 +7128,7 @@ CAST('10 ' as UNSIGNED INTEGER)
2
2
Warnings:
Warning 1292 Truncated incorrect INTEGER value: '10 '
Note 1292 Truncated incorrect INTEGER value: '10 '
DROP PROCEDURE p1;
DROP PROCEDURE p2;
DROP PROCEDURE p3;

View File

@@ -144,7 +144,7 @@ ERROR 42000: Variable 'sql_mode' can't be set to the value of 'NULL'
set session sql_mode=ansi;
create table t1
(f1 integer auto_increment primary key,
f2 timestamp default current_timestamp on update current_timestamp);
f2 timestamp not null default current_timestamp on update current_timestamp);
show create table t1;
Table Create Table
t1 CREATE TABLE "t1" (

View File

@@ -778,7 +778,7 @@ ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 VALUES ('-100E+1');
ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 VALUES ('-100E');
ERROR 22007: Incorrect decimal value: '-100E' for column 'col1' at row 1
ERROR 01000: Data truncated for column 'col1' at row 1
UPDATE t1 SET col1 =col1 * 50000 WHERE col1 =11;
ERROR 22003: Out of range value for column 'col1' at row 6
UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
@@ -790,10 +790,10 @@ ERROR 22007: Incorrect decimal value: '' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES ('a59b');
ERROR 22007: Incorrect decimal value: 'a59b' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES ('1a');
ERROR 22007: Incorrect decimal value: '1a' for column 'col1' at row 1
ERROR 01000: Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
Warnings:
Note 1265 Data truncated for column 'col1' at row 1
Warning 1265 Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 values (1/0);
Warnings:
Warning 1365 Division by 0
@@ -853,9 +853,9 @@ ERROR 22012: Division by 0
UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0;
ERROR 22012: Division by 0
INSERT INTO t1 (col1) VALUES ('');
ERROR 01000: Data truncated for column 'col1' at row 1
ERROR 22007: Incorrect double value: '' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES ('a59b');
ERROR 01000: Data truncated for column 'col1' at row 1
ERROR 22007: Incorrect double value: 'a59b' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES ('1a');
ERROR 01000: Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
@@ -903,9 +903,9 @@ ERROR 22012: Division by 0
UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0;
ERROR 22012: Division by 0
INSERT INTO t1 (col1) VALUES ('');
ERROR 01000: Data truncated for column 'col1' at row 1
ERROR 22007: Incorrect double value: '' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES ('a59b');
ERROR 01000: Data truncated for column 'col1' at row 1
ERROR 22007: Incorrect double value: 'a59b' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES ('1a');
ERROR 01000: Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
@@ -1125,6 +1125,8 @@ ERROR 22007: Truncated incorrect INTEGER value: '10a'
insert into t1 (col2) values (cast('10' as unsigned integer));
insert into t1 (col2) values (cast('10' as signed integer));
insert into t1 (col2) values (10E+0 + '0 ');
Warnings:
Note 1292 Truncated incorrect DOUBLE value: '0 '
select * from t1;
col1 col2
NULL 10
@@ -1265,7 +1267,7 @@ d
2000-10-01
drop table t1;
set @@sql_mode='traditional';
create table t1(a int, b timestamp);
create table t1(a int, b timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
alter table t1 add primary key(a);
show create table t1;
Table Create Table
@@ -1275,7 +1277,7 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1(a int, b timestamp default 20050102030405);
create table t1(a int, b timestamp not null default 20050102030405);
alter table t1 add primary key(a);
show create table t1;
Table Create Table

View File

@@ -6312,12 +6312,22 @@ SELECT 1 FROM t1 WHERE a =
ORDER BY b
);
1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'b'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'b'
SELECT 1 FROM t1 WHERE a =
(SELECT 1 FROM t2 WHERE b =
(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
GROUP BY b
);
1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'b'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'b'
DROP TABLE t1, t2;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)

View File

@@ -296,8 +296,6 @@ INSERT INTO t1 VALUES ('2011-05-13', 0);
SELECT * FROM t1 WHERE b < (SELECT CAST(a as date) FROM t1 GROUP BY a);
a b
2011-05-13 0
Warnings:
Warning 1292 Incorrect datetime value: '0'
DROP TABLE t1;
#
# Bug #11766300 59387: FAILING ASSERTION: CURSOR->POS_STATE == 1997660512 (BTR_PCUR_IS_POSITIONE

View File

@@ -6312,12 +6312,22 @@ SELECT 1 FROM t1 WHERE a =
ORDER BY b
);
1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'b'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'b'
SELECT 1 FROM t1 WHERE a =
(SELECT 1 FROM t2 WHERE b =
(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
GROUP BY b
);
1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'b'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'b'
DROP TABLE t1, t2;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)

View File

@@ -6307,12 +6307,22 @@ SELECT 1 FROM t1 WHERE a =
ORDER BY b
);
1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'b'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'b'
SELECT 1 FROM t1 WHERE a =
(SELECT 1 FROM t2 WHERE b =
(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
GROUP BY b
);
1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'b'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'b'
DROP TABLE t1, t2;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)

View File

@@ -6303,12 +6303,22 @@ SELECT 1 FROM t1 WHERE a =
ORDER BY b
);
1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'b'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'b'
SELECT 1 FROM t1 WHERE a =
(SELECT 1 FROM t2 WHERE b =
(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
GROUP BY b
);
1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'b'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'b'
DROP TABLE t1, t2;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)

View File

@@ -6318,12 +6318,22 @@ SELECT 1 FROM t1 WHERE a =
ORDER BY b
);
1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'b'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'b'
SELECT 1 FROM t1 WHERE a =
(SELECT 1 FROM t2 WHERE b =
(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
GROUP BY b
);
1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'b'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'b'
DROP TABLE t1, t2;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)

View File

@@ -6303,12 +6303,22 @@ SELECT 1 FROM t1 WHERE a =
ORDER BY b
);
1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'b'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'b'
SELECT 1 FROM t1 WHERE a =
(SELECT 1 FROM t2 WHERE b =
(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
GROUP BY b
);
1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'b'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'b'
DROP TABLE t1, t2;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)

View File

@@ -415,6 +415,13 @@ i j k @b
15 NULL 15 Fired
set @b:="";
load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, j);
Warnings:
Note 1265 Data truncated for column 'i' at row 1
Note 1265 Data truncated for column 'j' at row 1
Note 1265 Data truncated for column 'i' at row 2
Note 1265 Data truncated for column 'j' at row 2
Note 1265 Data truncated for column 'i' at row 3
Note 1265 Data truncated for column 'j' at row 3
select *, @b from t1;
i j k @b
10 NULL 10 Fired

View File

@@ -748,5 +748,59 @@ Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a`
DROP TABLE t1;
SET timestamp=DEFAULT;
#
# MDEV-8795 Equal expression propagation does not work for temporal literals
#
CREATE TABLE t1 (a DATE);
INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-02');
EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=DATE'2001-01-01' AND COALESCE(a)>=DATE'2001-01-01';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = DATE'2001-01-01')
DROP TABLE t1;
#
# MDEV-8658 DATE(zerofill_column) and DATE(COALESCE(zerofill_column)) return different results
#
CREATE TABLE t1 (a INT(6) ZEROFILL, b DECIMAL(6) ZEROFILL, c DOUBLE(6,0) ZEROFILL);
INSERT INTO t1 VALUES (1,1,1);
INSERT INTO t1 VALUES (10101,10101,10101);
SELECT DATE(a), DATE(b), DATE(c) FROM t1;
DATE(a) DATE(b) DATE(c)
NULL NULL NULL
2001-01-01 2001-01-01 2001-01-01
Warnings:
Warning 1292 Incorrect datetime value: '1' for column 'a' at row 1
Warning 1292 Incorrect datetime value: '1' for column 'b' at row 1
Warning 1292 Incorrect datetime value: '1' for column 'c' at row 1
SELECT DATE(COALESCE(a)), DATE(COALESCE(b)), DATE(COALESCE(c)) FROM t1;
DATE(COALESCE(a)) DATE(COALESCE(b)) DATE(COALESCE(c))
NULL NULL NULL
2001-01-01 2001-01-01 2001-01-01
Warnings:
Warning 1292 Incorrect datetime value: '1'
Warning 1292 Incorrect datetime value: '1'
Warning 1292 Incorrect datetime value: '1'
DROP TABLE t1;
CREATE TABLE t1 (a INT(6), b DECIMAL(6), c DOUBLE(6,0));
INSERT INTO t1 VALUES (1,1,1);
INSERT INTO t1 VALUES (10101,10101,10101);
SELECT DATE(a), DATE(b), DATE(c) FROM t1;
DATE(a) DATE(b) DATE(c)
NULL NULL NULL
2001-01-01 2001-01-01 2001-01-01
Warnings:
Warning 1292 Incorrect datetime value: '1' for column 'a' at row 1
Warning 1292 Incorrect datetime value: '1' for column 'b' at row 1
Warning 1292 Incorrect datetime value: '1' for column 'c' at row 1
SELECT DATE(COALESCE(a)), DATE(COALESCE(b)), DATE(COALESCE(c)) FROM t1;
DATE(COALESCE(a)) DATE(COALESCE(b)) DATE(COALESCE(c))
NULL NULL NULL
2001-01-01 2001-01-01 2001-01-01
Warnings:
Warning 1292 Incorrect datetime value: '1'
Warning 1292 Incorrect datetime value: '1'
Warning 1292 Incorrect datetime value: '1'
DROP TABLE t1;
#
# End of 10.1 tests
#

View File

@@ -57,7 +57,7 @@ select * from t1;
t
0000-00-00 00:00:00
drop table t1;
CREATE TABLE t1 (a timestamp, b date, c time, d datetime);
CREATE TABLE t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, b date, c time, d datetime);
insert into t1 (b,c,d) values(now(),curtime(),now());
Warnings:
Note 1265 Data truncated for column 'b' at row 1
@@ -229,7 +229,7 @@ ERROR 42000: Invalid default value for 'da'
create table t1 (t time default '916:00:00 a');
ERROR 42000: Invalid default value for 't'
set @@sql_mode= @org_mode;
create table t1 (f1 date, f2 datetime, f3 timestamp);
create table t1 (f1 date, f2 datetime, f3 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
insert into t1(f1) values(curdate());
select curdate() < now(), f1 < now(), cast(f1 as date) < now() from t1;
curdate() < now() f1 < now() cast(f1 as date) < now()
@@ -266,7 +266,7 @@ f1 f2 f1 > f2 f1 = f2 f1 < f2
2001-04-15 2001-04-15 00:00:00 0 1 0
2001-05-20 2001-05-20 01:01:01 0 0 1
drop table t1;
create table t1 (f1 date, f2 datetime, f3 timestamp);
create table t1 (f1 date, f2 datetime, f3 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
insert into t1 values('2001-01-01','2001-01-01 01:01:01','2001-01-01 01:01:01');
insert into t1 values('2001-02-05','2001-02-05 00:00:00','2001-02-05 01:01:01');
insert into t1 values('2001-03-10','2001-03-09 01:01:01','2001-03-10 01:01:01');
@@ -1085,5 +1085,16 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00') and (<cache>(length(TIMESTAMP'2001-01-01 00:00:00')) = (40 + rand())))
DROP TABLE t1;
#
# MDEV-8795 Equal expression propagation does not work for temporal literals
#
CREATE TABLE t1 (a DATETIME);
INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-02 00:00:00');
EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=TIMESTAMP'2001-01-01 00:00:00' AND COALESCE(a)>=TIMESTAMP'2001-01-01 00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = TIMESTAMP'2001-01-01 00:00:00')
DROP TABLE t1;
#
# End of 10.1 tests
#

View File

@@ -181,7 +181,7 @@ Note 1265 Data truncated for column 'a' at row 3
Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column 'a' at row 4
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings:
Note 1265 Data truncated for column 'a' at row 1
Warning 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 3
select * from t1;
a
@@ -246,7 +246,7 @@ Note 1265 Data truncated for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 3
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings:
Note 1265 Data truncated for column 'a' at row 1
Warning 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 3
select * from t1;
a
@@ -305,7 +305,7 @@ Note 1265 Data truncated for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 3
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings:
Note 1265 Data truncated for column 'a' at row 1
Warning 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 3
select * from t1;
a
@@ -358,6 +358,9 @@ insert into t1 values (123.4e0),(123.4e+2),(123.4e-2),(123e1),(123e+0);
Warnings:
Note 1265 Data truncated for column 'a' at row 3
insert into t1 values (MID("987",1,2)),("987 "),("987.6e+2 ");
Warnings:
Note 1265 Data truncated for column 'a' at row 2
Note 1265 Data truncated for column 'a' at row 3
select * from t1;
a
0.00

View File

@@ -458,7 +458,7 @@ Warnings:
Warning 1265 Data truncated for column 'f' at row 1
INSERT INTO t1 VALUES ('.');
Warnings:
Warning 1265 Data truncated for column 'f' at row 1
Warning 1366 Incorrect double value: '.' for column 'f' at row 1
SELECT * FROM t1 ORDER BY f;
f
0

View File

@@ -2042,33 +2042,19 @@ SELECT t1.* FROM t1 JOIN t2 USING(a);
a
10:20:30.000000
10:20:30.000000
Warnings:
Note 1292 Truncated incorrect time value: '102030.0000000000'
Note 1292 Truncated incorrect time value: '102030.0000000010'
SELECT t1.* FROM t1 LEFT JOIN t2 USING(a);
a
10:20:30.000000
10:20:30.000000
Warnings:
Note 1292 Truncated incorrect time value: '102030.0000000000'
Note 1292 Truncated incorrect time value: '102030.0000000000'
Note 1292 Truncated incorrect time value: '102030.0000000010'
ALTER TABLE t2 ADD PRIMARY KEY(a);
SELECT t1.* FROM t1 JOIN t2 USING(a);
a
10:20:30.000000
10:20:30.000000
Warnings:
Note 1292 Truncated incorrect time value: '102030.0000000000'
Note 1292 Truncated incorrect time value: '102030.0000000010'
SELECT t1.* FROM t1 LEFT JOIN t2 USING(a);
a
10:20:30.000000
10:20:30.000000
Warnings:
Note 1292 Truncated incorrect time value: '102030.0000000000'
Note 1292 Truncated incorrect time value: '102030.0000000000'
Note 1292 Truncated incorrect time value: '102030.0000000010'
# t2 should NOT be eliminated
EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 USING(a);
id select_type table type possible_keys key key_len ref rows Extra
@@ -2156,5 +2142,14 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010.0)
DROP TABLE t1;
#
# MDEV-8635 Redundant warnings on WHERE decimal_column='ax'
#
CREATE TABLE t1 (a DECIMAL, KEY(a)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
EXPLAIN SELECT * FROM t1 WHERE a='ax' ORDER BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 6 const 1 Using where; Using index; Using filesort
DROP TABLE t1;
#
# End of 10.1 tests
#

1222
mysql-test/r/type_num.result Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -15,7 +15,7 @@ ushort smallint(5) unsigned zerofill DEFAULT '00000' NOT NULL,
umedium mediumint(8) unsigned DEFAULT '0' NOT NULL,
ulong int(11) unsigned DEFAULT '0' NOT NULL,
ulonglong bigint(13) unsigned DEFAULT '0' NOT NULL,
time_stamp timestamp,
time_stamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
date_field date,
time_field time,
date_time datetime,

View File

@@ -958,5 +958,253 @@ Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a`
DROP TABLE t1;
SET timestamp=DEFAULT;
#
# MDEV-8795 Equal expression propagation does not work for temporal literals
#
CREATE TABLE t1 (a TIME);
INSERT INTO t1 VALUES ('00:00:01'),('00:00:02');
EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:01' AND COALESCE(a)>=TIME'00:00:01';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = TIME'00:00:01')
DROP TABLE t1;
#
# MDEV-8793 Wrong result set for SELECT ... WHERE COALESCE(time_column)=TIME('00:00:00') AND COALESCE(time_column)=DATE('2015-09-11')
#
SET timestamp=UNIX_TIMESTAMP('2015-09-11 20:20:20');
CREATE TABLE t1 (a TIME);
INSERT INTO t1 VALUES('10:20:30'),('00:00:00');
SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00');
a
00:00:00
SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11');
a
00:00:00
# TIME cast + DATE cast
SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE('2015-09-11');
a
00:00:00
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE('2015-09-11');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = <cache>(00:00:00))
# TIME cast + DATE literal
SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE'2015-09-11';
a
00:00:00
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE'2015-09-11';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = <cache>(00:00:00))
# TIME literal + DATE cast
SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:00' AND COALESCE(a)=DATE('2015-09-11');
a
00:00:00
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:00' AND COALESCE(a)=DATE('2015-09-11');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = TIME'00:00:00')
# TIME literal + DATE literal
SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:00' AND COALESCE(a)=DATE'2015-09-11';
a
00:00:00
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:00' AND COALESCE(a)=DATE'2015-09-11';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = TIME'00:00:00')
# TIME-alike string literal + DATE cast
SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE('2015-09-11');
a
00:00:00
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE('2015-09-11');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = '00:00:00') and (coalesce(`test`.`t1`.`a`) = <cache>(2015-09-11 00:00:00)))
# TIME-alike string literal + DATE literal
SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE'2015-09-11';
a
00:00:00
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE'2015-09-11';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = '00:00:00') and (coalesce(`test`.`t1`.`a`) = DATE'2015-09-11'))
# TIME-alike integer literal + DATE cast
SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE('2015-09-11');
a
00:00:00
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE('2015-09-11');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = 0) and (coalesce(`test`.`t1`.`a`) = <cache>(2015-09-11 00:00:00)))
# TIME-alike integer literal + DATE literal
SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE'2015-09-11';
a
00:00:00
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE'2015-09-11';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = 0) and (coalesce(`test`.`t1`.`a`) = DATE'2015-09-11'))
# DATE cast + TIME cast
SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME('00:00:00');
a
00:00:00
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME('00:00:00');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = <cache>(2015-09-11 00:00:00))
# DATE cast + TIME literal
SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME'00:00:00';
a
00:00:00
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME'00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = <cache>(2015-09-11 00:00:00))
# DATE cast + TIME-alike string literal
SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)='00:00:00';
a
00:00:00
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)='00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = <cache>(2015-09-11 00:00:00)) and (coalesce(`test`.`t1`.`a`) = '00:00:00'))
# DATE cast + TIME-alike integer literal
SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=0;
a
00:00:00
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = <cache>(2015-09-11 00:00:00)) and (coalesce(`test`.`t1`.`a`) = 0))
# DATE literal + TIME cast
SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=TIME('00:00:00');
a
00:00:00
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=TIME('00:00:00');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = DATE'2015-09-11')
# DATE literal + TIME literal
SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=TIME'00:00:00';
a
00:00:00
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=TIME'00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = DATE'2015-09-11')
# DATE literal + TIME-alike string literal
SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)='00:00:00';
a
00:00:00
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)='00:00:00';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = DATE'2015-09-11') and (coalesce(`test`.`t1`.`a`) = '00:00:00'))
# DATE literal + TIME-alike integer literal
SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=0;
a
00:00:00
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = DATE'2015-09-11') and (coalesce(`test`.`t1`.`a`) = 0))
DROP TABLE t1;
SET timestamp=DEFAULT;
#
# MDEV-8814 Wrong result for WHERE datetime_column > TIME('00:00:00')
#
CREATE TABLE t1 (a DATETIME);
INSERT INTO t1 VALUES ('2000-09-12 00:00:00'), ('2007-04-25 05:08:49');
SELECT * FROM t1 WHERE a>TIME'00:00:00';
a
SELECT * FROM t1 WHERE a>TIME('00:00:00');
a
DROP TABLE t1;
#
# MDEV-8660 TIME(int_zerofill_column) returns a wrong result
#
CREATE TABLE t1 (a BIGINT(15), b BIGINT(15) ZEROFILL);
INSERT INTO t1 VALUES (9,9);
SELECT TIME(a),TIME(b) FROM t1;
TIME(a) TIME(b)
00:00:09 00:00:09
DROP TABLE t1;
CREATE TABLE t1 (a BIGINT);
INSERT INTO t1 VALUES (-9223372036854775808);
SELECT CAST(a AS TIME), CAST(-9223372036854775808 AS TIME) FROM t1;
CAST(a AS TIME) CAST(-9223372036854775808 AS TIME)
-838:59:59 -838:59:59
Warnings:
Warning 1292 Incorrect time value: '-9223372036854775808' for column 'a' at row 1
Warning 1292 Truncated incorrect time value: '-9223372036854775808'
DROP TABLE t1;
CREATE TABLE t1 (a INT, b DECIMAL, c DOUBLE);
INSERT INTO t1 VALUES (-9000000,-9000000,-9000000);
INSERT INTO t1 VALUES (-1,-1,-1);
INSERT INTO t1 VALUES (0,0,0),(1,1,1),(9,9,9);
INSERT INTO t1 VALUES (9000000,9000000,9000000);
SELECT a, TIME(a),TIME(b),TIME(c) FROM t1 ORDER BY a;
a TIME(a) TIME(b) TIME(c)
-9000000 -838:59:59 -838:59:59 -838:59:59.999999
-1 -00:00:01 -00:00:01 -00:00:01.000000
0 00:00:00 00:00:00 00:00:00.000000
1 00:00:01 00:00:01 00:00:01.000000
9 00:00:09 00:00:09 00:00:09.000000
9000000 838:59:59 838:59:59 838:59:59.999999
Warnings:
Warning 1292 Incorrect time value: '-9000000' for column 'a' at row 1
Warning 1292 Incorrect time value: '-9000000' for column 'b' at row 1
Warning 1292 Incorrect time value: '-9000000' for column 'c' at row 1
Warning 1292 Incorrect time value: '9000000' for column 'a' at row 6
Warning 1292 Incorrect time value: '9000000' for column 'b' at row 6
Warning 1292 Incorrect time value: '9000000' for column 'c' at row 6
DROP TABLE t1;
CREATE TABLE t1 (a INT, b DECIMAL, c DOUBLE);
INSERT INTO t1 VALUES (0,0,0),(1,1,1),(9,9,9);
INSERT INTO t1 VALUES (9000000,9000000,9000000);
SELECT a, TIME(a),TIME(b),TIME(c) FROM t1 ORDER BY a;
a TIME(a) TIME(b) TIME(c)
0 00:00:00 00:00:00 00:00:00.000000
1 00:00:01 00:00:01 00:00:01.000000
9 00:00:09 00:00:09 00:00:09.000000
9000000 838:59:59 838:59:59 838:59:59.999999
Warnings:
Warning 1292 Incorrect time value: '9000000' for column 'a' at row 4
Warning 1292 Incorrect time value: '9000000' for column 'b' at row 4
Warning 1292 Incorrect time value: '9000000' for column 'c' at row 4
DROP TABLE t1;
#
# End of 10.1 tests
#

View File

@@ -1,6 +1,6 @@
drop table if exists t1,t2;
set time_zone="+03:00";
CREATE TABLE t1 (a int, t timestamp);
CREATE TABLE t1 (a int, t timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
CREATE TABLE t2 (a int, t datetime);
SET TIMESTAMP=1234;
insert into t1 values(1,NULL);
@@ -27,7 +27,7 @@ a t
9 1970-01-01 03:20:38
drop table t1,t2;
SET TIMESTAMP=1234;
CREATE TABLE t1 (value TEXT NOT NULL, id VARCHAR(32) NOT NULL, stamp timestamp, PRIMARY KEY (id));
CREATE TABLE t1 (value TEXT NOT NULL, id VARCHAR(32) NOT NULL, stamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (id));
INSERT INTO t1 VALUES ("my value", "myKey","1999-04-02 00:00:00");
SELECT stamp FROM t1 WHERE id="myKey";
stamp
@@ -41,13 +41,13 @@ SELECT stamp FROM t1 WHERE id="myKey";
stamp
1999-04-02 00:00:00
drop table t1;
create table t1 (a timestamp);
create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
insert into t1 values (now());
select date_format(a,"%Y %y"),year(a),year(now()) from t1;
date_format(a,"%Y %y") year(a) year(now())
1970 70 1970 1970
drop table t1;
create table t1 (ix timestamp);
create table t1 (ix timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
insert into t1 values (19991101000000),(19990102030405),(19990630232922),(19990601000000),(19990930232922),(19990531232922),(19990501000000),(19991101000000),(19990501000000);
select ix+0 from t1;
ix+0
@@ -69,7 +69,7 @@ ix+0
19990630232922
19990601000000
drop table t1;
CREATE TABLE t1 (date date, date_time datetime, time_stamp timestamp);
CREATE TABLE t1 (date date, date_time datetime, time_stamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
INSERT INTO t1 VALUES ("1998-12-31","1998-12-31 23:59:59",19981231235959);
INSERT INTO t1 VALUES ("1999-01-01","1999-01-01 00:00:00",19990101000000);
INSERT INTO t1 VALUES ("1999-09-09","1999-09-09 23:59:59",19990909235959);
@@ -97,7 +97,7 @@ date date_time time_stamp
2005-01-01 2005-01-01 00:00:00 2005-01-01 00:00:00
2030-01-01 2030-01-01 00:00:00 2030-01-01 00:00:00
drop table t1;
create table t1 (ix timestamp);
create table t1 (ix timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
insert into t1 values (0),(20030101010160),(20030101016001),(20030101240101),(20030132010101),(20031301010101),(20031200000000),(20030000000000);
Warnings:
Warning 1265 Data truncated for column 'ix' at row 2
@@ -157,7 +157,7 @@ create table t1 (t1 timestamp default now(), t2 timestamp on update now());
drop table t1;
create table t1 (t1 timestamp on update now(), t2 timestamp default now() on update now());
drop table t1;
create table t1 (t1 timestamp default '2003-01-01 00:00:00', t2 datetime, t3 timestamp);
create table t1 (t1 timestamp not null default '2003-01-01 00:00:00', t2 datetime, t3 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00');
SET TIMESTAMP=1000000000;
insert into t1 values ();
SET TIMESTAMP=1000000001;
@@ -181,7 +181,7 @@ t1 timestamp NO 2003-01-01 00:00:00
t2 datetime YES NULL
t3 timestamp NO 0000-00-00 00:00:00
drop table t1;
create table t1 (t1 timestamp default now(), t2 datetime, t3 timestamp);
create table t1 (t1 timestamp not null default now(), t2 datetime, t3 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00');
SET TIMESTAMP=1000000002;
insert into t1 values ();
SET TIMESTAMP=1000000003;
@@ -205,7 +205,7 @@ t1 timestamp NO CURRENT_TIMESTAMP
t2 datetime YES NULL
t3 timestamp NO 0000-00-00 00:00:00
drop table t1;
create table t1 (t1 timestamp default '2003-01-01 00:00:00' on update now(), t2 datetime);
create table t1 (t1 timestamp not null default '2003-01-01 00:00:00' on update now(), t2 datetime);
SET TIMESTAMP=1000000004;
insert into t1 values ();
select * from t1;
@@ -230,7 +230,7 @@ Field Type Null Key Default Extra
t1 timestamp NO 2003-01-01 00:00:00 on update CURRENT_TIMESTAMP
t2 datetime YES NULL
drop table t1;
create table t1 (t1 timestamp default now() on update now(), t2 datetime);
create table t1 (t1 timestamp not null default now() on update now(), t2 datetime);
SET TIMESTAMP=1000000006;
insert into t1 values ();
select * from t1;
@@ -255,7 +255,7 @@ Field Type Null Key Default Extra
t1 timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
t2 datetime YES NULL
drop table t1;
create table t1 (t1 timestamp, t2 datetime, t3 timestamp);
create table t1 (t1 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, t2 datetime, t3 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00');
SET TIMESTAMP=1000000007;
insert into t1 values ();
select * from t1;
@@ -282,7 +282,7 @@ t1 timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
t2 datetime YES NULL
t3 timestamp NO 0000-00-00 00:00:00
drop table t1;
create table t1 (t1 timestamp default current_timestamp on update current_timestamp, t2 datetime);
create table t1 (t1 timestamp not null default current_timestamp on update current_timestamp, t2 datetime);
SET TIMESTAMP=1000000009;
insert into t1 values ();
select * from t1;
@@ -318,7 +318,7 @@ select * from t1;
t1 t2
2004-04-03 00:00:00 2004-04-01 00:00:00
drop table t1;
create table t1 (pk int primary key, t1 timestamp default current_timestamp on update current_timestamp, bulk int);
create table t1 (pk int primary key, t1 timestamp not null default current_timestamp on update current_timestamp, bulk int);
insert into t1 values (1, '2004-04-01 00:00:00', 10);
SET TIMESTAMP=1000000013;
replace into t1 set pk = 1, bulk= 20;
@@ -326,7 +326,7 @@ select * from t1;
pk t1 bulk
1 2001-09-09 04:46:53 20
drop table t1;
create table t1 (pk int primary key, t1 timestamp default '2003-01-01 00:00:00' on update current_timestamp, bulk int);
create table t1 (pk int primary key, t1 timestamp not null default '2003-01-01 00:00:00' on update current_timestamp, bulk int);
insert into t1 values (1, '2004-04-01 00:00:00', 10);
SET TIMESTAMP=1000000014;
replace into t1 set pk = 1, bulk= 20;
@@ -334,7 +334,7 @@ select * from t1;
pk t1 bulk
1 2003-01-01 00:00:00 20
drop table t1;
create table t1 (pk int primary key, t1 timestamp default current_timestamp, bulk int);
create table t1 (pk int primary key, t1 timestamp not null default current_timestamp on update current_timestamp, bulk int);
insert into t1 values (1, '2004-04-01 00:00:00', 10);
SET TIMESTAMP=1000000015;
replace into t1 set pk = 1, bulk= 20;
@@ -342,7 +342,7 @@ select * from t1;
pk t1 bulk
1 2001-09-09 04:46:55 20
drop table t1;
create table t1 (t1 timestamp default current_timestamp on update current_timestamp);
create table t1 (t1 timestamp not null default current_timestamp on update current_timestamp);
insert into t1 values ('2004-04-01 00:00:00');
SET TIMESTAMP=1000000016;
alter table t1 add i int default 10;
@@ -397,13 +397,13 @@ drop table t1;
create table t1 (a bigint, b bigint);
insert into t1 values (NULL, NULL), (20030101000000, 20030102000000);
set timestamp=1000000019;
alter table t1 modify a timestamp, modify b timestamp;
alter table t1 modify a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, modify b timestamp NOT NULL DEFAULT '0000-00-00 00:00:0';
select * from t1;
a b
2001-09-09 04:46:59 2001-09-09 04:46:59
2003-01-01 00:00:00 2003-01-02 00:00:00
drop table t1;
create table t1 (a char(2), t timestamp);
create table t1 (a char(2), t timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
insert into t1 values ('a', '2004-01-01 00:00:00'), ('a', '2004-01-01 01:00:00'),
('b', '2004-02-01 00:00:00');
select max(t) from t1 group by a;
@@ -421,7 +421,7 @@ t1 CREATE TABLE "t1" (
)
set sql_mode='';
drop table t1;
create table t1 (a int auto_increment primary key, b int, c timestamp);
create table t1 (a int auto_increment primary key, b int, c timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
insert into t1 (a, b, c) values (1, 0, '2001-01-01 01:01:01'),
(2, 0, '2002-02-02 02:02:02'), (3, 0, '2003-03-03 03:03:03');
select * from t1;
@@ -486,8 +486,8 @@ is_nullable
NO
drop table t1;
CREATE TABLE t1 ( f1 INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
f2 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
f3 TIMESTAMP);
f2 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
f3 TIMESTAMP NOT NULL default '0000-00-00 00:00:00');
INSERT INTO t1 (f2,f3) VALUES (NOW(), "0000-00-00 00:00:00");
INSERT INTO t1 (f2,f3) VALUES (NOW(), NULL);
INSERT INTO t1 (f2,f3) VALUES (NOW(), ASCII(NULL));
@@ -507,7 +507,7 @@ End of 5.0 tests
# Bug #55779: select does not work properly in mysql server
# Version "5.1.42 SUSE MySQL RPM"
#
CREATE TABLE t1 (a TIMESTAMP, KEY (a));
CREATE TABLE t1 (a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, KEY (a));
INSERT INTO t1 VALUES ('2000-01-01 00:00:00'), ('2000-01-01 00:00:00'),
('2000-01-01 00:00:01'), ('2000-01-01 00:00:01');
SELECT a FROM t1 WHERE a >= 20000101000000;
@@ -604,7 +604,7 @@ Warning 1292 Incorrect datetime value: 'abc'
Bug#50888 valgrind warnings in Field_timestamp::val_str
SET TIMESTAMP=0;
CREATE TABLE t1(a timestamp);
CREATE TABLE t1(a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
INSERT INTO t1 VALUES ('2008-02-23 09:23:45'), ('2010-03-05 11:08:02');
FLUSH TABLES t1;
SELECT MAX(a) FROM t1;

View File

@@ -50,7 +50,7 @@ a
2010-12-11 03:04:05.789
2010-12-11 15:47:11.123
drop table t1;
create table t1 (a timestamp(4)) engine=innodb;
create table t1 (a timestamp(4)NOT NULL DEFAULT CURRENT_TIMESTAMP(4) ON UPDATE CURRENT_TIMESTAMP(4)) engine=innodb;
insert t1 values ('2010-12-11 01:02:03.456789');
select * from t1;
a
@@ -216,7 +216,7 @@ decimal5_f4_timestamp 2010-11-12 11:14:17.7654
bigint_f5_timestamp 2010-11-12 11:14:17.00000
varchar_f6_timestamp 2010-11-12 11:14:17.765432
drop table t1, t2;
create table t1 (a timestamp(6), b timestamp(6));
create table t1 (a timestamp(6)NOT NULL DEFAULT '0000-00-00 00:00:00.000000', b timestamp(6)NOT NULL DEFAULT '0000-00-00 00:00:00.000000');
create procedure foo(x timestamp, y timestamp(4)) insert into t1 values (x, y);
call foo('2010-02-03 4:5:6.789123', '2010-02-03 4:5:6.789123');
select * from t1;
@@ -266,7 +266,7 @@ drop table t1, t2;
SET timestamp=DEFAULT;
set time_zone='+03:00';
set timestamp=unix_timestamp('2011-01-01 01:01:01') + 0.123456;
create table t1 (a timestamp(5));
create table t1 (a timestamp(5) DEFAULT CURRENT_TIMESTAMP);
insert t1 values ();
select * from t1;
a

View File

@@ -499,6 +499,7 @@ SELECT 5 = a FROM t1;
0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 's'
Warning 1292 Truncated incorrect DOUBLE value: ''
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(16));
INSERT INTO t1 VALUES ('5'), ('s'), ('');
@@ -509,6 +510,7 @@ SELECT 5 = a FROM t1;
0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 's '
Warning 1292 Truncated incorrect DOUBLE value: ' '
DROP TABLE t1;
#
# Start of 10.0 tests

View File

@@ -1342,7 +1342,7 @@ id
5
99
drop table t1;
create table t1(f1 char(1), f2 char(5), f3 binary(1), f4 binary(5), f5 timestamp, f6 varchar(1) character set utf8 collate utf8_general_ci, f7 text);
create table t1(f1 char(1), f2 char(5), f3 binary(1), f4 binary(5), f5 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', f6 varchar(1) character set utf8 collate utf8_general_ci, f7 text);
create table t2 as select *, f6 as f8 from t1 union select *, f7 from t1;
show create table t2;
Table Create Table

View File

@@ -175,6 +175,8 @@ b'' 0+b''
select x'', 0+x'';
x'' 0+x''
0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
select 0x;
ERROR 42S22: Unknown column '0x' in 'field list'
select 0b;

View File

@@ -1350,8 +1350,11 @@ a b
delete from t1;
load data infile '../../std_data/loaddata3.dat' ignore into table v1 fields terminated by '' enclosed by '' ignore 1 lines;
Warnings:
Note 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 2
Warning 1366 Incorrect integer value: 'error ' for column 'a' at row 3
Warning 1369 CHECK OPTION failed 'test.v1'
Note 1265 Data truncated for column 'a' at row 3
Warning 1366 Incorrect integer value: 'wrong end ' for column 'a' at row 4
Warning 1369 CHECK OPTION failed 'test.v1'
select * from t1 order by a,b;
@@ -5604,8 +5607,12 @@ INSERT INTO t1 VALUES ('DD'), ('ZZ'), ('ZZ'), ('KK'), ('FF'), ('HH'),('MM'),('`1
CREATE VIEW v1 AS SELECT * FROM t1;
SELECT * FROM t1 WHERE a <> 0 AND a = ' 1';
a
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '`1'
SELECT * FROM v1 WHERE a <> 0 AND a = ' 1';
a
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '`1'
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 (a ENUM('5','6'));
@@ -5627,8 +5634,12 @@ INSERT INTO t1 VALUES ('DD'), ('ZZ'), ('ZZ'), ('KK'), ('FF'), ('HH'),('MM'),('`1
CREATE VIEW v1 AS SELECT * FROM t1;
SELECT * FROM t1 WHERE a <> 0 AND a = ' 1';
a
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '`1'
SELECT * FROM v1 WHERE a <> 0 AND a = ' 1';
a
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '`1'
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 (a ENUM('5','6'));

View File

@@ -1161,6 +1161,8 @@ SET NAMES latin1;
SELECT UPDATEXML(CONVERT('' USING swe7), TRUNCATE('',1), 0);
UPDATEXML(CONVERT('' USING swe7), TRUNCATE('',1), 0)
NULL
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
#
# Bug#12375190: UPDATEXML CRASHES ON SIMPLE INPUTS
#

View File

@@ -107,7 +107,7 @@ CREATE TABLE t1 (c29 DATETIME);
INSERT INTO t1 VALUES ('2001-02-03 10:20:30');
DELETE FROM t1 WHERE c29='2001-02-03 10:20:30';
DROP TABLE t1;
CREATE TABLE t1 (c30 TIMESTAMP);
CREATE TABLE t1 (c30 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
INSERT INTO t1 VALUES ('2001-02-03 10:20:30');
DELETE FROM t1 WHERE c30='2001-02-03 10:20:30';
DROP TABLE t1;
@@ -1675,7 +1675,7 @@ DROP TABLE `t1` /* generated by server */
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
CREATE TABLE t1 (c30 TIMESTAMP)
CREATE TABLE t1 (c30 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP)
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # GTID 0-1-98

View File

@@ -50,7 +50,7 @@ c27 DECIMAL ZEROFILL,
#
c28 DATE,
c29 DATETIME,
c30 TIMESTAMP,
c30 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
c31 TIME,
c32 YEAR,
#
@@ -2306,7 +2306,7 @@ c27 DECIMAL ZEROFILL,
#
c28 DATE,
c29 DATETIME,
c30 TIMESTAMP,
c30 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
c31 TIME,
c32 YEAR,
#
@@ -4818,7 +4818,14 @@ LOAD DATA INFILE '../../std_data/loaddata5.dat'
INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (c1,c2)
SET c3 = 'Wow';
affected rows: 3
info: Records: 3 Deleted: 0 Skipped: 0 Warnings: 0
info: Records: 3 Deleted: 0 Skipped: 0 Warnings: 6
Warnings:
Note 1265 Data truncated for column 'c1' at row 1
Note 1265 Data truncated for column 'c2' at row 1
Note 1265 Data truncated for column 'c1' at row 2
Note 1265 Data truncated for column 'c2' at row 2
Note 1265 Data truncated for column 'c1' at row 3
Note 1265 Data truncated for column 'c2' at row 3
#
# Show what we have in the table.
#

View File

@@ -50,7 +50,7 @@ c27 DECIMAL ZEROFILL,
#
c28 DATE,
c29 DATETIME,
c30 TIMESTAMP,
c30 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
c31 TIME,
c32 YEAR,
#
@@ -2306,7 +2306,7 @@ c27 DECIMAL ZEROFILL,
#
c28 DATE,
c29 DATETIME,
c30 TIMESTAMP,
c30 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
c31 TIME,
c32 YEAR,
#
@@ -4857,7 +4857,14 @@ LOAD DATA INFILE '../../std_data/loaddata5.dat'
INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (c1,c2)
SET c3 = 'Wow';
affected rows: 3
info: Records: 3 Deleted: 0 Skipped: 0 Warnings: 0
info: Records: 3 Deleted: 0 Skipped: 0 Warnings: 6
Warnings:
Note 1265 Data truncated for column 'c1' at row 1
Note 1265 Data truncated for column 'c2' at row 1
Note 1265 Data truncated for column 'c1' at row 2
Note 1265 Data truncated for column 'c2' at row 2
Note 1265 Data truncated for column 'c1' at row 3
Note 1265 Data truncated for column 'c2' at row 3
#
# Show what we have in the table.
#

View File

@@ -142,7 +142,7 @@ INSERT INTO t1 VALUES ('2001-02-03 10:20:30');
DELETE FROM t1 WHERE c29='2001-02-03 10:20:30';
DROP TABLE t1;
CREATE TABLE t1 (c30 TIMESTAMP);
CREATE TABLE t1 (c30 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
INSERT INTO t1 VALUES ('2001-02-03 10:20:30');
DELETE FROM t1 WHERE c30='2001-02-03 10:20:30';
DROP TABLE t1;

View File

@@ -0,0 +1,23 @@
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
set global innodb_compression_algorithm = 1;
# Create and populate a tables
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
CREATE TABLE t2 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
CREATE TABLE t3 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED ENCRYPTED=NO;
CREATE TABLE t4 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB PAGE_COMPRESSED=1;
CREATE TABLE t5 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB PAGE_COMPRESSED=1 ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
# Write file to make mysql-test-run.pl expect the "crash", but don't
# start it until it's told to
# We give 30 seconds to do a clean shutdown because we do not want
# to redo apply the pages of t1.ibd at the time of recovery.
# We want SQL to initiate the first access to t1.ibd.
# Wait until disconnected.
# Run innochecksum on t1
# Run innochecksum on t2
# Run innochecksum on t3
# Run innochecksum on t4
# Run innochecksum on t4
# Write file to make mysql-test-run.pl start up the server again
# Cleanup
DROP TABLE t1, t2, t3, t4, t5;

View File

@@ -7,7 +7,7 @@ call mtr.add_suppression("InnoDB: Marking tablespace as missing. You may drop th
call mtr.add_suppression(".*InnoDB: Cannot open table test/.* from the internal data dictionary of InnoDB though the .frm file for the table exists. See .* for how you can resolve the problem.");
call mtr.add_suppression("InnoDB: .ibd file is missing for table test/.*");
call mtr.add_suppression("mysqld: File .*");
call mtr.add_suppression("InnoDB: Tablespace id 6 is encrypted but encryption service or used key_id .* is not available. Can't continue opening tablespace.");
call mtr.add_suppression("InnoDB: Tablespace id .* is encrypted but encryption service or used key_id .* is not available. Can't continue opening tablespace.");
# Start server with keys2.txt
SET GLOBAL innodb_file_format = `Barracuda`;
@@ -33,12 +33,12 @@ foobar 2
# Restart server with keysbad3.txt
SELECT * FROM t1;
ERROR 42S02: Table 'test.t1' doesn't exist in engine
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW WARNINGS;
Level Code Message
Warning 1812 Tablespace is missing for table 'test/t1'
Warning 155 Table test/t1 is encrypted but encryption service or used key_id 2 is not available. Can't continue reading table.
Error 1932 Table 'test.t1' doesn't exist in engine
Warning 192 Table test/t1 is encrypted but encryption service or used key_id 2 is not available. Can't continue reading table.
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
DROP TABLE t1;
# Start server with keys.txt
CREATE TABLE t2 (c VARCHAR(8), id int not null primary key, b int, key(b)) ENGINE=InnoDB ENCRYPTED=YES;
@@ -46,90 +46,90 @@ INSERT INTO t2 VALUES ('foobar',1,2);
# Restart server with keys2.txt
SELECT * FROM t2;
Got one of the listed errors
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW WARNINGS;
Level Code Message
Warning 155 Table test/t2 in tablespace 7 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Warning 155 Table test/t2 in tablespace 7 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Warning 155 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1932 Table 'test.t2' doesn't exist in engine
Warning 192 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Warning 192 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Warning 192 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SELECT * FROM t2 where id = 1;
Got one of the listed errors
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW WARNINGS;
Level Code Message
Warning 1812 Tablespace is missing for table 'test/t2'
Warning 155 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1932 Table 'test.t2' doesn't exist in engine
Warning 192 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SELECT * FROM t2 where b = 1;
Got one of the listed errors
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW WARNINGS;
Level Code Message
Warning 1812 Tablespace is missing for table 'test/t2'
Warning 155 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1932 Table 'test.t2' doesn't exist in engine
Warning 192 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
INSERT INTO t2 VALUES ('tmp',3,3);
ERROR 42S02: Table 'test.t2' doesn't exist in engine
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW WARNINGS;
Level Code Message
Warning 1812 Tablespace is missing for table 'test/t2'
Warning 155 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1932 Table 'test.t2' doesn't exist in engine
Warning 192 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
DELETE FROM t2 where b = 3;
Got one of the listed errors
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW WARNINGS;
Level Code Message
Warning 1812 Tablespace is missing for table 'test/t2'
Warning 155 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1932 Table 'test.t2' doesn't exist in engine
Warning 192 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
DELETE FROM t2 where id = 3;
Got one of the listed errors
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW WARNINGS;
Level Code Message
Warning 1812 Tablespace is missing for table 'test/t2'
Warning 155 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1932 Table 'test.t2' doesn't exist in engine
Warning 192 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
UPDATE t2 set b = b +1;
Got one of the listed errors
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW WARNINGS;
Level Code Message
Warning 1812 Tablespace is missing for table 'test/t2'
Warning 155 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1932 Table 'test.t2' doesn't exist in engine
Warning 192 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
OPTIMIZE TABLE t2;
Table Op Msg_type Msg_text
test.t2 optimize Warning Tablespace is missing for table 'test/t2'
test.t2 optimize Warning Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
test.t2 optimize Error Table 'test.t2' doesn't exist in engine
test.t2 optimize status Operation failed
test.t2 optimize Error Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
test.t2 optimize error Corrupt
SHOW WARNINGS;
Level Code Message
ALTER TABLE t2 ADD COLUMN c INT;
ERROR 42S02: Table 'test.t2' doesn't exist in engine
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW WARNINGS;
Level Code Message
Warning 1812 Tablespace is missing for table 'test/t2'
Warning 155 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1932 Table 'test.t2' doesn't exist in engine
Warning 192 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
test.t2 analyze Warning Tablespace is missing for table 'test/t2'
test.t2 analyze Warning Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
test.t2 analyze Error Table 'test.t2' doesn't exist in engine
test.t2 analyze status Operation failed
test.t2 analyze Error Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
test.t2 analyze error Corrupt
SHOW WARNINGS;
Level Code Message
TRUNCATE TABLE t2;
ERROR 42S02: Table 'test.t2' doesn't exist in engine
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW WARNINGS;
Level Code Message
Warning 1812 Tablespace is missing for table 'test/t2'
Warning 155 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1932 Table 'test.t2' doesn't exist in engine
Warning 192 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
DROP TABLE t2;
ERROR HY000: Table 't2' is read only
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW WARNINGS;
Level Code Message
Error 1036 Table 't2' is read only
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
# Restart server with keys.txt
DROP TABLE t2;

View File

@@ -7,10 +7,20 @@ call mtr.add_suppression("Couldn't load plugins from 'file_key_management*");
CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTION_KEY_ID=4;
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
select * from t1;
alter table t1 discard tablespace;
alter table t1 engine=InnoDB;
ERROR 42S02: Table 'test.t1' doesn't exist in engine
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
show warnings;
Level Code Message
Warning 155 Table test/t1 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1932 Table 'test.t1' doesn't exist in engine
Warning 192 Table test/t1 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Warning 192 Table test/t1 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
alter table t1 discard tablespace;
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
show warnings;
Level Code Message
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
alter table t1 engine=InnoDB;
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
show warnings;
Level Code Message
Warning 192 Table test/t1 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB

View File

@@ -0,0 +1,44 @@
call mtr.add_suppression("InnoDB: Table .* tablespace is set as discarded");
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
set global innodb_compression_algorithm = 1;
CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(255)) ENGINE=InnoDB PAGE_COMPRESSED=1 ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL,
`f` varchar(255) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `ENCRYPTED`=YES `ENCRYPTION_KEY_ID`=4
INSERT INTO t1 VALUES (1,'foobar'),(2,'barfoo');
FLUSH TABLE t1 FOR EXPORT;
# List before copying files
t1.cfg
t1.frm
t1.ibd
UNLOCK TABLES;
# Tablespaces should be still encrypted
# t1 yes on expecting NOT FOUND
NOT FOUND /foobar/ in t1.ibd
ALTER TABLE t1 DISCARD TABLESPACE;
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
# List after t1 DISCARD
t1.frm
ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL,
`f` varchar(255) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `ENCRYPTED`=YES `ENCRYPTION_KEY_ID`=4
SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table 't1'
# Tablespaces should be still encrypted
# t1 yes on expecting NOT FOUND
NOT FOUND /foobar/ in t1.ibd
DROP TABLE t1;

View File

@@ -0,0 +1,20 @@
call mtr.add_suppression("InnoDB: Block in space_id .* in file test/.* encrypted");
call mtr.add_suppression("InnoDB: However key management plugin or used key_id 1 is not found or used encryption algorithm or method does not match.");
call mtr.add_suppression("InnoDB: Marking tablespace as missing. You may drop this table or install correct key management plugin and key file.");
call mtr.add_suppression(".*InnoDB: Cannot open table test/.* from the internal data dictionary of InnoDB though the .frm file for the table exists. See .* for how you can resolve the problem.");
call mtr.add_suppression("InnoDB: .ibd file is missing for table test/.*");
call mtr.add_suppression("Couldn't load plugins from 'file_key_management*");
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTION_KEY_ID=4;
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check Warning Table test/t1 in tablespace 4 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
test.t1 check Warning Table test/t1 is encrypted but encryption service or used key_id is not available. Can't continue checking table.
test.t1 check error Corrupt
SHOW WARNINGS;
Level Code Message
DROP TABLE t1;

View File

@@ -0,0 +1,28 @@
call mtr.add_suppression("InnoDB: Block in space_id .* in file test/.* encrypted");
call mtr.add_suppression("InnoDB: However key management plugin or used key_id 1 is not found or used encryption algorithm or method does not match.");
call mtr.add_suppression("InnoDB: Marking tablespace as missing. You may drop this table or install correct key management plugin and key file.");
call mtr.add_suppression(".*InnoDB: Cannot open table test/.* from the internal data dictionary of InnoDB though the .frm file for the table exists. See .* for how you can resolve the problem.");
call mtr.add_suppression("InnoDB: .ibd file is missing for table test/.*");
call mtr.add_suppression("Couldn't load plugins from 'file_key_management*");
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTION_KEY_ID=4;
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize Warning Table test/t1 is encrypted but encryption service or used key_id is not available. Can't continue checking table.
test.t1 optimize Warning InnoDB: Cannot defragment table test/t1: returned error code 192
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
test.t1 optimize error Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
test.t1 optimize status Operation failed
Warnings:
Warning 192 Table test/t1 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW WARNINGS;
Level Code Message
Warning 192 Table test/t1 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
DROP TABLE t1;

View File

@@ -0,0 +1,144 @@
call mtr.add_suppression("InnoDB: Table .* tablespace is set as discarded");
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_compression_algorithm = 1;
create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=4;
show warnings;
Level Code Message
create table t2(c1 bigint not null, b char(200)) engine=innodb page_compressed=1 encrypted=yes encryption_key_id=4;
show warnings;
Level Code Message
create table t3(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encrypted=yes encryption_key_id=4;
show warnings;
Level Code Message
create table t4(c1 bigint not null, b char(200)) engine=innodb page_compressed=1;
show warnings;
Level Code Message
create procedure innodb_insert_proc (repeat_count int)
begin
declare current_num int;
set current_num = 0;
while current_num < repeat_count do
insert into t1 values(current_num, repeat('foobar',30));
insert into t2 values(current_num, repeat('barfoo',30));
insert into t3 values(current_num, repeat('tmpres',30));
insert into t4 values(current_num, repeat('mysql',30));
set current_num = current_num + 1;
end while;
end//
commit;
set autocommit=0;
call innodb_insert_proc(2000);
commit;
set autocommit=1;
select count(*) from t1;
count(*)
2000
select count(*) from t2;
count(*)
2000
select count(*) from t3;
count(*)
2000
select count(*) from t4;
count(*)
2000
FLUSH TABLE t1,t2,t3,t4 FOR EXPORT;
# List before copying files
t1.cfg
t1.frm
t1.ibd
t2.cfg
t2.frm
t2.ibd
t3.cfg
t3.frm
t3.ibd
t4.cfg
t4.frm
t4.ibd
UNLOCK TABLES;
# tables should be either encrypted and/or compressed
# t1 yes on expecting NOT FOUND
NOT FOUND /foobar/ in t1.ibd
# t2 yes on expecting NOT FOUND
NOT FOUND /barfoo/ in t2.ibd
# t3 yes on expecting NOT FOUND
NOT FOUND /tmpres/ in t3.ibd
# t4 yes on expecting NOT FOUND
NOT FOUND /mysql/ in t4.ibd
ALTER TABLE t1 DISCARD TABLESPACE;
ALTER TABLE t2 DISCARD TABLESPACE;
ALTER TABLE t3 DISCARD TABLESPACE;
ALTER TABLE t4 DISCARD TABLESPACE;
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_compression_algorithm = 1;
# List after t1 DISCARD
t1.frm
t2.frm
t3.frm
t4.frm
ALTER TABLE t1 IMPORT TABLESPACE;
Warnings:
Warning 1814 Tablespace has been discarded for table 't1'
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` bigint(20) NOT NULL,
`b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes `encryption_key_id`=4
SELECT COUNT(*) FROM t1;
COUNT(*)
2000
ALTER TABLE t2 IMPORT TABLESPACE;
Warnings:
Warning 1814 Tablespace has been discarded for table 't2'
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`c1` bigint(20) NOT NULL,
`b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `encrypted`=yes `encryption_key_id`=4
SELECT COUNT(*) FROM t2;
COUNT(*)
2000
ALTER TABLE t3 IMPORT TABLESPACE;
Warnings:
Warning 1814 Tablespace has been discarded for table 't3'
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
`c1` bigint(20) NOT NULL,
`b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED `encrypted`=yes `encryption_key_id`=4
SELECT COUNT(*) FROM t3;
COUNT(*)
2000
ALTER TABLE t4 IMPORT TABLESPACE;
Warnings:
Warning 1814 Tablespace has been discarded for table 't4'
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
`c1` bigint(20) NOT NULL,
`b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1
SELECT COUNT(*) FROM t4;
COUNT(*)
2000
flush data to disk
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_compression_algorithm = 1;
# tables should be still either encrypted and/or compressed
# t1 yes on expecting NOT FOUND
NOT FOUND /foobar/ in t1.ibd
# t2 yes on expecting NOT FOUND
NOT FOUND /barfoo/ in t2.ibd
# t3 yes on expecting NOT FOUND
NOT FOUND /tmpres/ in t3.ibd
# t4 yes on expecting NOT FOUND
NOT FOUND /mysql/ in t4.ibd
DROP PROCEDURE innodb_insert_proc;
DROP TABLE t1,t2,t3,t4;

View File

@@ -0,0 +1,53 @@
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_encrypt_tables = ON;
SET GLOBAL innodb_encryption_threads = 4;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=NO ENCRYPTION_KEY_ID=4;
Warnings:
Warning 140 InnoDB: Ignored ENCRYPTION_KEY_ID 4 when encryption is disabled
DROP TABLE t1;
set innodb_default_encryption_key_id = 99;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB;
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: ENCRYPTION_KEY_ID 99 not available
Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=YES;
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: ENCRYPTION_KEY_ID 99 not available
Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
set innodb_default_encryption_key_id = 4;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=YES;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL AUTO_INCREMENT,
`c` varchar(256) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `ENCRYPTED`=YES `ENCRYPTION_KEY_ID`=4
DROP TABLE t1;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL AUTO_INCREMENT,
`c` varchar(256) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `ENCRYPTION_KEY_ID`=4
CREATE TABLE t2 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=NO ENCRYPTION_KEY_ID=1;
Warnings:
Warning 140 InnoDB: Ignored ENCRYPTION_KEY_ID 1 when encryption is disabled
ALTER TABLE t1 ENCRYPTION_KEY_ID=99;
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: ENCRYPTION_KEY_ID 99 not available
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
set innodb_default_encryption_key_id = 1;
drop table t1,t2;

View File

@@ -0,0 +1,66 @@
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_encrypt_tables = OFF;
SET GLOBAL innodb_encryption_threads = 4;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL AUTO_INCREMENT,
`c` varchar(256) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
CREATE TABLE t2 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=YES;
CREATE TABLE t3 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=NO;
CREATE TABLE t4 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
INSERT INTO t2 select * from t1;
INSERT INTO t3 select * from t1;
INSERT INTO t4 select * from t1;
SET GLOBAL innodb_encrypt_tables = on;
# Wait max 10 min for key encryption threads to encrypt required all spaces
# Success!
SELECT COUNT(1) FROM t1;
COUNT(1)
400
SELECT COUNT(1) FROM t2;
COUNT(1)
400
SELECT COUNT(1) FROM t3;
COUNT(1)
400
SELECT COUNT(1) FROM t4;
COUNT(1)
400
SET GLOBAL innodb_encrypt_tables = off;
# Wait max 10 min for key encryption threads to decrypt all required spaces
# Success!
SET GLOBAL innodb_encrypt_tables = ON;
set GLOBAL innodb_default_encryption_key_id=4;
CREATE TABLE t5 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB;
SHOW CREATE TABLE t5;
Table Create Table
t5 CREATE TABLE `t5` (
`pk` int(11) NOT NULL AUTO_INCREMENT,
`c` varchar(256) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
INSERT INTO t5 select * from t1;
# Wait max 10 min for key encryption threads to encrypt required all spaces
# Success!
SELECT COUNT(1) FROM t1;
COUNT(1)
400
SELECT COUNT(1) FROM t2;
COUNT(1)
400
SELECT COUNT(1) FROM t3;
COUNT(1)
400
SELECT COUNT(1) FROM t4;
COUNT(1)
400
SELECT COUNT(1) FROM t5;
COUNT(1)
400
drop table t1,t2,t3,t4, t5;
set GLOBAL innodb_default_encryption_key_id=1;

View File

@@ -27,7 +27,7 @@ insert t3 values (repeat('dummy', 42));
--echo # Wait max 10 min for key encryption threads to encrypt all spaces
--let $wait_timeout= 600
--let $wait_condition=SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0
--let $wait_condition=SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0
--source include/wait_condition.inc
--sleep 5
@@ -55,7 +55,7 @@ SET GLOBAL innodb_encrypt_tables = off;
--echo # Wait max 10 min for key encryption threads to decrypt all spaces
--let $wait_timeout= 600
--let $wait_condition=SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
--let $wait_condition=SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
--source include/wait_condition.inc
--sleep 5
@@ -82,7 +82,7 @@ SET GLOBAL innodb_encrypt_tables = on;
--echo # Wait max 10 min for key encryption threads to encrypt all spaces
--let $wait_timeout= 600
--let $wait_condition=SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
--let $wait_condition=SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
--source include/wait_condition.inc
--sleep 5

View File

@@ -0,0 +1,4 @@
if (!$FILE_KEY_MANAGEMENT_SO)
{
--skip Needs dynamic file_key_management plugin
}

View File

@@ -0,0 +1,101 @@
#
# MDEV-8773: InnoDB innochecksum does not work with encrypted or page compressed tables
#
# Don't test under embedded
-- source include/not_embedded.inc
# Require InnoDB
-- source include/have_innodb.inc
-- source include/have_file_key_management_plugin.inc
if (!$INNOCHECKSUM) {
--echo Need innochecksum binary
--die Need innochecksum binary
}
--disable_query_log
let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`;
let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
--enable_query_log
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
# zlib
set global innodb_compression_algorithm = 1;
--echo # Create and populate a tables
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
CREATE TABLE t2 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
CREATE TABLE t3 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED ENCRYPTED=NO;
CREATE TABLE t4 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB PAGE_COMPRESSED=1;
CREATE TABLE t5 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB PAGE_COMPRESSED=1 ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
--disable_query_log
--let $i = 1000
while ($i)
{
INSERT INTO t1 (b) VALUES (REPEAT('abcdefghijklmnopqrstuvwxyz', 100));
dec $i;
}
INSERT INTO t2 SELECT * FROM t1;
INSERT INTO t3 SELECT * FROM t1;
INSERT INTO t4 SELECT * FROM t1;
INSERT INTO t5 SELECT * FROM t1;
--enable_query_log
let $MYSQLD_DATADIR=`select @@datadir`;
let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd;
let t2_IBD = $MYSQLD_DATADIR/test/t2.ibd;
let t3_IBD = $MYSQLD_DATADIR/test/t3.ibd;
let t4_IBD = $MYSQLD_DATADIR/test/t4.ibd;
let t5_IBD = $MYSQLD_DATADIR/test/t5.ibd;
--echo # Write file to make mysql-test-run.pl expect the "crash", but don't
--echo # start it until it's told to
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--echo # We give 30 seconds to do a clean shutdown because we do not want
--echo # to redo apply the pages of t1.ibd at the time of recovery.
--echo # We want SQL to initiate the first access to t1.ibd.
shutdown_server 30;
--echo # Wait until disconnected.
--source include/wait_until_disconnected.inc
--echo # Run innochecksum on t1
-- disable_result_log
--exec $INNOCHECKSUM $t1_IBD
--echo # Run innochecksum on t2
--exec $INNOCHECKSUM $t2_IBD
--echo # Run innochecksum on t3
--exec $INNOCHECKSUM $t3_IBD
--echo # Run innochecksum on t4
--exec $INNOCHECKSUM $t4_IBD
--echo # Run innochecksum on t4
--exec $INNOCHECKSUM $t4_IBD
--enable_result_log
--echo # Write file to make mysql-test-run.pl start up the server again
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
--echo # Cleanup
DROP TABLE t1, t2, t3, t4, t5;
# reset system
--disable_query_log
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig;
EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
--enable_query_log

Some files were not shown because too many files have changed in this diff Show More