Merge branch 'bb-10.0-vicentiu' into 10.0

This commit is contained in:
Vicențiu Ciorbaru 2017-03-06 21:50:42 +02:00
commit c4f3e64c23
322 changed files with 10743 additions and 5252 deletions

2
.gitignore vendored
View File

@ -214,7 +214,7 @@ support-files/mysql.spec
support-files/mysqld_multi.server
support-files/wsrep.cnf
support-files/wsrep_notify
support-files/SELinux/centos6-mariadb.pp
support-files/SELinux/mariadb.pp
tags
tests/async_queries
tests/bug25714

View File

@ -348,6 +348,9 @@ SET(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
# Common defines and includes
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
IF(_FILE_OFFSET_BITS)
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS})
ENDIF()
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/include)
# Add bundled or system zlib.

View File

@ -698,8 +698,9 @@ static void write_header(FILE *sql_file, char *db_name)
"-- MySQL dump %s Distrib %s, for %s (%s)\n--\n",
DUMP_VERSION, MYSQL_SERVER_VERSION, SYSTEM_TYPE,
MACHINE_TYPE);
print_comment(sql_file, 0, "-- Host: %s Database: %s\n",
fix_for_comment(current_host ? current_host : "localhost"),
print_comment(sql_file, 0, "-- Host: %s ",
fix_for_comment(current_host ? current_host : "localhost"));
print_comment(sql_file, 0, "Database: %s\n",
fix_for_comment(db_name ? db_name : ""));
print_comment(sql_file, 0,
"-- ------------------------------------------------------\n"

View File

@ -484,7 +484,6 @@
#cmakedefine _LARGE_FILES 1
#cmakedefine _LARGEFILE_SOURCE 1
#cmakedefine _LARGEFILE64_SOURCE 1
#cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@
#cmakedefine TIME_WITH_SYS_TIME 1

View File

@ -64,9 +64,9 @@ typedef struct my_aio_result {
#define MY_FAE 8 /* Fatal if any error */
#define MY_WME 16 /* Write message on error */
#define MY_WAIT_IF_FULL 32 /* Wait and try again if disk full error */
#define MY_IGNORE_BADFD 32 /* my_sync: ignore 'bad descriptor' errors */
#define MY_UNUSED 64 /* Unused (was support for RAID) */
#define MY_FULL_IO 512 /* For my_read - loop intil I/O is complete */
#define MY_IGNORE_BADFD 32 /* my_sync(): ignore 'bad descriptor' errors */
#define MY_NOSYMLINKS 512 /* my_open(): don't follow symlinks */
#define MY_FULL_IO 512 /* my_read(): loop intil I/O is complete */
#define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */
#define MY_LINK_WARNING 32 /* my_redel() gives warning if links */
#define MY_COPYTIME 64 /* my_redel() copys time */
@ -253,7 +253,7 @@ extern ulong my_file_opened,my_stream_opened, my_tmp_file_created;
extern ulong my_file_total_opened;
extern ulong my_sync_count;
extern uint mysys_usage_id;
extern my_bool my_init_done;
extern my_bool my_init_done, my_thr_key_mysys_exists;
extern my_bool my_assert_on_error;
extern myf my_global_flags; /* Set to MY_WME for more error messages */
/* Point to current my_message() */
@ -567,6 +567,7 @@ my_off_t my_b_safe_tell(IO_CACHE* info); /* picks the correct tell() */
typedef uint32 ha_checksum;
extern ulong my_crc_dbug_check;
extern int (*mysys_test_invalid_symlink)(const char *filename);
#include <my_alloc.h>
/* Prototypes for mysys and my_func functions */
@ -594,9 +595,11 @@ extern int my_realpath(char *to, const char *filename, myf MyFlags);
extern File my_create_with_symlink(const char *linkname, const char *filename,
int createflags, int access_flags,
myf MyFlags);
extern int my_delete_with_symlink(const char *name, myf MyFlags);
extern int my_rename_with_symlink(const char *from,const char *to,myf MyFlags);
extern int my_symlink(const char *content, const char *linkname, myf MyFlags);
extern int my_handler_delete_with_symlink(PSI_file_key key, const char *name,
const char *ext, myf sync_dir);
extern size_t my_read(File Filedes,uchar *Buffer,size_t Count,myf MyFlags);
extern size_t my_pread(File Filedes,uchar *Buffer,size_t Count,my_off_t offset,
myf MyFlags);

View File

@ -441,20 +441,6 @@
inline_mysql_file_create_with_symlink(P1, P2, P3, P4, P5)
#endif
/**
@def mysql_file_delete_with_symlink(K, P1, P2)
Instrumented delete with symbolic link.
@c mysql_file_delete_with_symlink is a replacement
for @c my_delete_with_symlink.
*/
#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_delete_with_symlink(K, P1, P2) \
inline_mysql_file_delete_with_symlink(K, __FILE__, __LINE__, P1, P2)
#else
#define mysql_file_delete_with_symlink(K, P1, P2) \
inline_mysql_file_delete_with_symlink(P1, P2)
#endif
/**
@def mysql_file_rename_with_symlink(K, P1, P2, P3)
Instrumented rename with symbolic link.
@ -1337,31 +1323,6 @@ inline_mysql_file_create_with_symlink(
return file;
}
static inline int
inline_mysql_file_delete_with_symlink(
#ifdef HAVE_PSI_FILE_INTERFACE
PSI_file_key key, const char *src_file, uint src_line,
#endif
const char *name, myf flags)
{
int result;
#ifdef HAVE_PSI_FILE_INTERFACE
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_FILE_CALL(get_thread_file_name_locker)
(&state, key, PSI_FILE_DELETE, name, &locker);
if (likely(locker != NULL))
{
PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line);
result= my_delete_with_symlink(name, flags);
PSI_FILE_CALL(end_file_close_wait)(locker, result);
return result;
}
#endif
result= my_delete_with_symlink(name, flags);
return result;
}
static inline int
inline_mysql_file_rename_with_symlink(

View File

@ -417,7 +417,7 @@ enum PSI_file_operation
PSI_FILE_FSTAT= 12,
/** File chsize, as in @c my_chsize(). */
PSI_FILE_CHSIZE= 13,
/** File delete, such as @c my_delete() or @c my_delete_with_symlink(). */
/** File delete, such as @c my_delete() or @c my_handler_delete_with_symlink(). */
PSI_FILE_DELETE= 14,
/** File rename, such as @c my_rename() or @c my_rename_with_symlink(). */
PSI_FILE_RENAME= 15,

View File

@ -0,0 +1,27 @@
--source include/have_partition.inc
--source include/gap_lock_error_init.inc
let $select_lock=for update;
let $autocommit = 0;
--source include/gap_lock_error_select.inc
let $autocommit = 1;
--source include/gap_lock_error_select.inc
let $select_lock=lock in share mode;
let $autocommit = 0;
--source include/gap_lock_error_select.inc
let $autocommit = 1;
--source include/gap_lock_error_select.inc
let $select_lock=;
let $autocommit = 0;
--source include/gap_lock_error_select.inc
let $autocommit = 1;
--source include/gap_lock_error_select.inc
let $autocommit = 0;
--source include/gap_lock_error_update.inc
let $autocommit = 1;
--source include/gap_lock_error_update.inc
--source include/gap_lock_error_cleanup.inc

View File

@ -0,0 +1 @@
drop table gap1, gap2, gap3, gap4;

View File

@ -0,0 +1,24 @@
eval CREATE TABLE gap1 (id1 INT, id2 INT, id3 INT, c1 INT, value INT,
PRIMARY KEY (id1, id2, id3),
INDEX i (c1)) ENGINE=$engine;
CREATE TABLE gap2 like gap1;
eval CREATE TABLE gap3 (id INT, value INT,
PRIMARY KEY (id),
UNIQUE KEY ui(value)) ENGINE=$engine;
eval CREATE TABLE gap4 (id INT, value INT,
PRIMARY KEY (id)) ENGINE=$engine
PARTITION BY HASH(id) PARTITIONS 2;
--disable_query_log
let $max = 1000;
let $i = 1;
while ($i <= $max) {
eval INSERT INTO gap1 (id1, id2, id3, c1, value)
VALUES ($i div 2, $i div 10, $i, $i, $i);
eval INSERT INTO gap2 (id1, id2, id3, c1, value)
VALUES ($i div 2, $i div 10, $i, $i, $i);
inc $i;
}
--enable_query_log
insert into gap3 values (1,1), (2,2),(3,3),(4,4),(5,5);
insert into gap4 values (1,1), (2,2),(3,3),(4,4),(5,5);

View File

@ -0,0 +1,89 @@
eval set session autocommit=$autocommit;
let $is_gaplock_target = `SELECT @@autocommit = 0 && '$select_lock' != '' && '$expect_gap_lock_errors' = 1`;
if ($is_gaplock_target)
{
# rnd_init
--error ER_UNKNOWN_ERROR
eval select * from gap1 limit 1 $select_lock;
--error ER_UNKNOWN_ERROR
eval select * from gap1 where value != 100 limit 1 $select_lock;
# index_read_map
--error ER_UNKNOWN_ERROR
eval select * from gap1 where id1=1 $select_lock;
--error ER_UNKNOWN_ERROR
eval select * from gap1 where id1=1 and id2= 1 $select_lock;
# read_range_first
--error ER_UNKNOWN_ERROR
eval select * from gap1 where id1=1 and id2= 1 and id3 != 1 $select_lock;
--error ER_UNKNOWN_ERROR
eval select * from gap1 where id1=1 and id2= 1 and id3
between 1 and 3 $select_lock;
--error ER_UNKNOWN_ERROR
eval select * from gap1 where id1=1 and id2= 1 order by id3 asc
limit 1 $select_lock;
--error ER_UNKNOWN_ERROR
eval select * from gap1 where id1=1 and id2= 1 order by id3 desc
limit 1 $select_lock;
# index_first
--error ER_UNKNOWN_ERROR
eval select * from gap1 order by id1 asc limit 1 $select_lock;
--error ER_UNKNOWN_ERROR
eval select * from gap1 order by id1 asc, id2 asc, id3 asc limit 1 $select_lock;
# index_last
--error ER_UNKNOWN_ERROR
eval select * from gap1 order by id1 desc limit 1 $select_lock;
--error ER_UNKNOWN_ERROR
eval select * from gap1 order by id1 desc, id2 desc, id3 desc
limit 1 $select_lock;
# secondary index lookup
--error ER_UNKNOWN_ERROR
eval select * from gap1 force index(i) where c1=1 $select_lock;
# unique index lookup, ensure no gap lock errors as this is effectively a
# single point select that does not lock ranges or gaps of keys
eval select * from gap3 force index(ui) where value=1 $select_lock;
# primary key lookup, ensure no gap lock errors as these are effectively
# single point selects that do not lock ranges or gaps of keys
eval select * from gap1 where id1=1 and id2=1 and id3=1 $select_lock;
eval select * from gap1 where id1=1 and id2=1 and id3 in (1, 2, 3) $select_lock;
eval select * from gap1 where id1=1 and id2=1 and id3=1 and value=1
order by c1 $select_lock;
eval select * from gap3 where id=1 $select_lock;
eval select * from gap4 where id=1 $select_lock;
eval select * from gap4 where id in (1, 2, 3) $select_lock;
--error ER_UNKNOWN_ERROR
eval select * from gap4 $select_lock;
--error ER_UNKNOWN_ERROR
eval select * from gap4 where id between 3 and 7 $select_lock;
}
if (!$is_gaplock_target)
{
eval select * from gap1 limit 1 $select_lock;
eval select * from gap1 where value != 100 limit 1 $select_lock;
eval select * from gap1 where id1=1 $select_lock;
eval select * from gap1 where id1=1 and id2= 1 $select_lock;
eval select * from gap1 where id1=1 and id2= 1 and id3 != 1 $select_lock;
eval select * from gap1 where id1=1 and id2= 1 and id3
between 1 and 3 $select_lock;
eval select * from gap1 where id1=1 and id2= 1 order by id3 asc
limit 1 $select_lock;
eval select * from gap1 where id1=1 and id2= 1 order by id3 desc
limit 1 $select_lock;
eval select * from gap1 order by id1 asc limit 1 $select_lock;
eval select * from gap1 order by id1 asc, id2 asc, id3 asc limit 1 $select_lock;
eval select * from gap1 order by id1 desc limit 1 $select_lock;
eval select * from gap1 order by id1 desc, id2 desc, id3 desc
limit 1 $select_lock;
eval select * from gap1 force index(i) where c1=1 $select_lock;
eval select * from gap3 force index(ui) where value=1 $select_lock;
eval select * from gap1 where id1=1 and id2=1 and id3=1 $select_lock;
eval select * from gap1 where id1=1 and id2=1 and id3 in (1, 2, 3) $select_lock;
eval select * from gap1 where id1=1 and id2=1 and id3=1 and value=1
order by c1 $select_lock;
eval select * from gap3 where id=1 $select_lock;
eval select * from gap4 where id=1 $select_lock;
eval select * from gap4 where id in (1, 2, 3) $select_lock;
eval select * from gap4 $select_lock;
eval select * from gap4 where id between 3 and 7 $select_lock;
}

View File

@ -0,0 +1,91 @@
eval set session autocommit=$autocommit;
let $is_gaplock_target = `SELECT @@autocommit = 0 && '$expect_gap_lock_errors' = 1`;
if ($is_gaplock_target)
{
## single-table insert,update,delete
insert into gap1 (id1, id2, id3) values (-1,-1,-1);
insert into gap1 (id1, id2, id3) values (-1,-1,-1)
on duplicate key update value=100;
--error ER_UNKNOWN_ERROR
update gap1 set value=100 where id1=1;
update gap1 set value=100 where id1=1 and id2=1 and id3=1;
--error ER_UNKNOWN_ERROR
delete from gap1 where id1=2;
delete from gap1 where id1=-1 and id2=-1 and id3=-1;
commit;
## multi-table statements (preventing all gap locks with autocommit)
# insert into select
--error ER_UNKNOWN_ERROR
insert into gap2 select * from gap1;
--error ER_UNKNOWN_ERROR
insert into gap2 select * from gap1 where id1=1;
insert into gap2 select * from gap1 where id1=1 and id2=1 and id3=1;
# create table select
create table t4 select * from gap1 where id1=1 and id2=1 and id3=1;
drop table t4;
--error ER_UNKNOWN_ERROR
create table t4 select * from gap1;
--error ER_UNKNOWN_ERROR
create table t4 select * from gap1 where id1=1;
# update join
update gap1 join gap2 on gap1.id1 and gap1.id2=gap2.id2 set gap1.value=100 where gap2.id1=3
and gap2.id2=3 and gap2.id3=3;
--error ER_UNKNOWN_ERROR
update gap1 join gap2 on gap1.id1 and gap1.id2=gap2.id2 set gap1.value=100 where gap2.id1=3;
--error ER_UNKNOWN_ERROR
update gap1 join gap2 on gap1.id1 and gap1.id2=gap2.id2 join gap3 on gap1.id1=gap3.id
set gap1.value=100 where gap2.id1=3;
--error ER_UNKNOWN_ERROR
update gap1 set gap1.value= (select count(*) from gap2);
# delete join
delete gap1 from gap1 join gap2 on gap1.id1 and gap1.id2=gap2.id2 where gap2.id1=3
and gap2.id2=3 and gap2.id3=3;
--error ER_UNKNOWN_ERROR
delete gap1 from gap1 join gap2 on gap1.id1 and gap1.id2=gap2.id2 where gap2.id1=3;
# select join / self join
--error ER_UNKNOWN_ERROR
select * from gap1, gap2 limit 1 for update;
--error ER_UNKNOWN_ERROR
select * from gap1 a, gap1 b limit 1 for update;
# unique secondary key
create table u1(
c1 int,
c2 int,
c3 int,
c4 int,
primary key (c1, c2, c3),
unique key (c3, c1)
);
begin;
insert into u1 values (1,1,1,1);
commit;
begin;
insert into u1 values (1,2,1,1) on duplicate key update c4=10;
commit;
begin;
select * from u1 where c3=1 and c1 = 1 for update;
--error ER_UNKNOWN_ERROR
select * from u1 where c3=1 for update;
commit;
drop table u1;
}
if (!$is_gaplock_target)
{
# autocommit doesn't prevent single table operations
insert into gap1 (id1, id2, id3) values (-1,-1,-1);
insert into gap1 (id1, id2, id3) values (-1,-1,-1)
on duplicate key update value=100;
update gap1 set value=100 where id1=1;
update gap1 set value=100 where id1=1 and id2=1 and id3=1;
delete from gap1 where id1=2;
delete from gap1 where id1=-1 and id2=-1 and id3=-1;
commit;
}

View File

@ -1014,4 +1014,27 @@ David Yes 210
Edward Yes 150
DROP TABLE example1463;
set sql_mode= @save_sql_mode;
#
# MDEV-9028: SELECT DISTINCT constant column of derived table
# used as the second operand of LEFT JOIN
#
create table t1 (id int, data varchar(255));
insert into t1 values (1,'yes'),(2,'yes');
select distinct t1.id, tt.id, tt.data
from t1
left join
(select t1.id, 'yes' as data from t1) as tt
on t1.id = tt.id;
id id data
1 1 yes
2 2 yes
select distinct t1.id, tt.id, tt.data
from t1
left join
(select t1.id, 'yes' as data from t1 where id > 1) as tt
on t1.id = tt.id;
id id data
2 2 yes
1 NULL NULL
drop table t1;
# end of 5.5

View File

@ -2526,6 +2526,54 @@ DROP USER mysqltest_u1@localhost;
# End of Bug#38347.
#
# BUG#11759114 - '51401: GRANT TREATS NONEXISTENT FUNCTIONS/PRIVILEGES
# DIFFERENTLY'.
#
drop database if exists mysqltest_db1;
create database mysqltest_db1;
create user mysqltest_u1;
# Both GRANT statements below should fail with the same error.
grant execute on function mysqltest_db1.f1 to mysqltest_u1;
ERROR 42000: FUNCTION or PROCEDURE f1 does not exist
grant execute on procedure mysqltest_db1.p1 to mysqltest_u1;
ERROR 42000: FUNCTION or PROCEDURE p1 does not exist
# Let us show that GRANT behaviour for routines is consistent
# with GRANT behaviour for tables. Attempt to grant privilege
# on non-existent table also results in an error.
grant select on mysqltest_db1.t1 to mysqltest_u1;
ERROR 42S02: Table 'mysqltest_db1.t1' doesn't exist
show grants for mysqltest_u1;
Grants for mysqltest_u1@%
GRANT USAGE ON *.* TO 'mysqltest_u1'@'%'
drop database mysqltest_db1;
drop user mysqltest_u1;
#
# Bug#12766319 - 61865: RENAME USER DOES NOT WORK CORRECTLY -
# REQUIRES FLUSH PRIVILEGES
#
CREATE USER foo@'127.0.0.1';
GRANT ALL ON *.* TO foo@'127.0.0.1';
# First attempt, should connect successfully
SELECT user(), current_user();
user() current_user()
foo@localhost foo@127.0.0.1
# Rename the user
RENAME USER foo@'127.0.0.1' to foo@'127.0.0.0/255.0.0.0';
# Second attempt, should connect successfully as its valid mask
# This was failing without fix
SELECT user(), current_user();
user() current_user()
foo@localhost foo@127.0.0.0/255.0.0.0
# Rename the user back to original
RENAME USER foo@'127.0.0.0/255.0.0.0' to foo@'127.0.0.1';
# Third attempt, should connect successfully
SELECT user(), current_user();
user() current_user()
foo@localhost foo@127.0.0.1
# Clean-up
DROP USER foo@'127.0.0.1';
# End of Bug#12766319
#
# Bug#11756966 - 48958: STORED PROCEDURES CAN BE LEVERAGED TO BYPASS
# DATABASE SECURITY
@ -2552,25 +2600,3 @@ ERROR 42000: Access denied for user 'untrusted'@'localhost' to database 'secret'
# Connection default
DROP USER untrusted@localhost;
DROP DATABASE secret;
#
# BUG#11759114 - '51401: GRANT TREATS NONEXISTENT FUNCTIONS/PRIVILEGES
# DIFFERENTLY'.
#
drop database if exists mysqltest_db1;
create database mysqltest_db1;
create user mysqltest_u1;
# Both GRANT statements below should fail with the same error.
grant execute on function mysqltest_db1.f1 to mysqltest_u1;
ERROR 42000: FUNCTION or PROCEDURE f1 does not exist
grant execute on procedure mysqltest_db1.p1 to mysqltest_u1;
ERROR 42000: FUNCTION or PROCEDURE p1 does not exist
# Let us show that GRANT behaviour for routines is consistent
# with GRANT behaviour for tables. Attempt to grant privilege
# on non-existent table also results in an error.
grant select on mysqltest_db1.t1 to mysqltest_u1;
ERROR 42S02: Table 'mysqltest_db1.t1' doesn't exist
show grants for mysqltest_u1;
Grants for mysqltest_u1@%
GRANT USAGE ON *.* TO 'mysqltest_u1'@'%'
drop database mysqltest_db1;
drop user mysqltest_u1;

View File

@ -1870,4 +1870,99 @@ f4
NULL
NULL
DROP TABLE t1,t2,t3,t4,t5;
#
# MDEV-7992: Nested left joins + 'not exists' optimization
#
CREATE TABLE t1(
K1 INT PRIMARY KEY,
Name VARCHAR(15)
);
INSERT INTO t1 VALUES
(1,'T1Row1'), (2,'T1Row2');
CREATE TABLE t2(
K2 INT PRIMARY KEY,
K1r INT,
rowTimestamp DATETIME,
Event VARCHAR(15)
);
INSERT INTO t2 VALUES
(1, 1, '2015-04-13 10:42:11' ,'T1Row1Event1'),
(2, 1, '2015-04-13 10:42:12' ,'T1Row1Event2'),
(3, 1, '2015-04-13 10:42:12' ,'T1Row1Event3');
SELECT t1a.*, t2a.*,
t2i.K2 AS K2B, t2i.K1r AS K1rB,
t2i.rowTimestamp AS rowTimestampB, t2i.Event AS EventB
FROM
t1 t1a JOIN t2 t2a ON t2a.K1r = t1a.K1
LEFT JOIN
( t1 t1i LEFT JOIN t2 t2i ON t2i.K1r = t1i.K1)
ON (t1i.K1 = 1) AND
(((t2i.K1r = t1a.K1 AND t2i.rowTimestamp > t2a.rowTimestamp ) OR
(t2i.rowTimestamp = t2a.rowTimestamp AND t2i.K2 > t2a.K2))
OR (t2i.K2 IS NULL))
WHERE
t2a.K1r = 1 AND t2i.K2 IS NULL;
K1 Name K2 K1r rowTimestamp Event K2B K1rB rowTimestampB EventB
1 T1Row1 3 1 2015-04-13 10:42:12 T1Row1Event3 NULL NULL NULL NULL
EXPLAIN EXTENDED SELECT t1a.*, t2a.*,
t2i.K2 AS K2B, t2i.K1r AS K1rB,
t2i.rowTimestamp AS rowTimestampB, t2i.Event AS EventB
FROM
t1 t1a JOIN t2 t2a ON t2a.K1r = t1a.K1
LEFT JOIN
( t1 t1i LEFT JOIN t2 t2i ON t2i.K1r = t1i.K1)
ON (t1i.K1 = 1) AND
(((t2i.K1r = t1a.K1 AND t2i.rowTimestamp > t2a.rowTimestamp ) OR
(t2i.rowTimestamp = t2a.rowTimestamp AND t2i.K2 > t2a.K2))
OR (t2i.K2 IS NULL))
WHERE
t2a.K1r = 1 AND t2i.K2 IS NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1a const PRIMARY PRIMARY 4 const 1 100.00
1 SIMPLE t2a ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t1i const PRIMARY PRIMARY 4 const 1 100.00 Using index
1 SIMPLE t2i ALL NULL NULL NULL NULL 3 100.00 Using where; Not exists
Warnings:
Note 1003 select 1 AS `K1`,'T1Row1' AS `Name`,`test`.`t2a`.`K2` AS `K2`,`test`.`t2a`.`K1r` AS `K1r`,`test`.`t2a`.`rowTimestamp` AS `rowTimestamp`,`test`.`t2a`.`Event` AS `Event`,`test`.`t2i`.`K2` AS `K2B`,`test`.`t2i`.`K1r` AS `K1rB`,`test`.`t2i`.`rowTimestamp` AS `rowTimestampB`,`test`.`t2i`.`Event` AS `EventB` from `test`.`t1` `t1a` join `test`.`t2` `t2a` left join (`test`.`t1` `t1i` left join `test`.`t2` `t2i` on((`test`.`t2i`.`K1r` = 1))) on(((`test`.`t1i`.`K1` = 1) and (((`test`.`t2i`.`K1r` = 1) and (`test`.`t2i`.`rowTimestamp` > `test`.`t2a`.`rowTimestamp`)) or ((`test`.`t2i`.`rowTimestamp` = `test`.`t2a`.`rowTimestamp`) and (`test`.`t2i`.`K2` > `test`.`t2a`.`K2`)) or isnull(`test`.`t2i`.`K2`)))) where ((`test`.`t2a`.`K1r` = 1) and isnull(`test`.`t2i`.`K2`))
CREATE VIEW v1 AS
SELECT t2i.*
FROM t1 as t1i LEFT JOIN t2 as t2i ON t2i.K1r = t1i.K1
WHERE t1i.K1 = 1 ;
SELECT
t1a.*, t2a.*, t2b.K2 as K2B, t2b.K1r as K1rB,
t2b.rowTimestamp as rowTimestampB, t2b.Event as EventB
FROM
t1 as t1a JOIN t2 as t2a ON t2a.K1r = t1a.K1
LEFT JOIN
v1 as t2b
ON ((t2b.K1r = t1a.K1 AND t2b.rowTimestamp > t2a.rowTimestamp) OR
(t2b.rowTimestamp = t2a.rowTimestamp AND t2b.K2 > t2a.K2))
OR (t2b.K2 IS NULL)
WHERE
t1a.K1 = 1 AND
t2b.K2 IS NULL;
K1 Name K2 K1r rowTimestamp Event K2B K1rB rowTimestampB EventB
1 T1Row1 3 1 2015-04-13 10:42:12 T1Row1Event3 NULL NULL NULL NULL
EXPLAIN EXTENDED SELECT
t1a.*, t2a.*, t2b.K2 as K2B, t2b.K1r as K1rB,
t2b.rowTimestamp as rowTimestampB, t2b.Event as EventB
FROM
t1 as t1a JOIN t2 as t2a ON t2a.K1r = t1a.K1
LEFT JOIN
v1 as t2b
ON ((t2b.K1r = t1a.K1 AND t2b.rowTimestamp > t2a.rowTimestamp) OR
(t2b.rowTimestamp = t2a.rowTimestamp AND t2b.K2 > t2a.K2))
OR (t2b.K2 IS NULL)
WHERE
t1a.K1 = 1 AND
t2b.K2 IS NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1a const PRIMARY PRIMARY 4 const 1 100.00
1 SIMPLE t2a ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t1i const PRIMARY PRIMARY 4 const 1 100.00 Using index
1 SIMPLE t2i ALL NULL NULL NULL NULL 3 100.00 Using where; Not exists
Warnings:
Note 1003 select 1 AS `K1`,'T1Row1' AS `Name`,`t2a`.`K2` AS `K2`,`t2a`.`K1r` AS `K1r`,`t2a`.`rowTimestamp` AS `rowTimestamp`,`t2a`.`Event` AS `Event`,`test`.`t2i`.`K2` AS `K2B`,`test`.`t2i`.`K1r` AS `K1rB`,`test`.`t2i`.`rowTimestamp` AS `rowTimestampB`,`test`.`t2i`.`Event` AS `EventB` from `test`.`t1` `t1a` join `test`.`t2` `t2a` left join (`test`.`t1` `t1i` left join `test`.`t2` `t2i` on((`test`.`t2i`.`K1r` = 1))) on(((`test`.`t1i`.`K1` = 1) and (((`test`.`t2i`.`K1r` = 1) and (`test`.`t2i`.`rowTimestamp` > `t2a`.`rowTimestamp`)) or ((`test`.`t2i`.`rowTimestamp` = `t2a`.`rowTimestamp`) and (`test`.`t2i`.`K2` > `t2a`.`K2`)) or isnull(`test`.`t2i`.`K2`)))) where ((`t2a`.`K1r` = 1) and isnull(`test`.`t2i`.`K2`))
DROP VIEW v1;
DROP TABLE t1,t2;
set optimizer_search_depth= @tmp_mdev621;

View File

@ -1881,6 +1881,101 @@ f4
NULL
NULL
DROP TABLE t1,t2,t3,t4,t5;
#
# MDEV-7992: Nested left joins + 'not exists' optimization
#
CREATE TABLE t1(
K1 INT PRIMARY KEY,
Name VARCHAR(15)
);
INSERT INTO t1 VALUES
(1,'T1Row1'), (2,'T1Row2');
CREATE TABLE t2(
K2 INT PRIMARY KEY,
K1r INT,
rowTimestamp DATETIME,
Event VARCHAR(15)
);
INSERT INTO t2 VALUES
(1, 1, '2015-04-13 10:42:11' ,'T1Row1Event1'),
(2, 1, '2015-04-13 10:42:12' ,'T1Row1Event2'),
(3, 1, '2015-04-13 10:42:12' ,'T1Row1Event3');
SELECT t1a.*, t2a.*,
t2i.K2 AS K2B, t2i.K1r AS K1rB,
t2i.rowTimestamp AS rowTimestampB, t2i.Event AS EventB
FROM
t1 t1a JOIN t2 t2a ON t2a.K1r = t1a.K1
LEFT JOIN
( t1 t1i LEFT JOIN t2 t2i ON t2i.K1r = t1i.K1)
ON (t1i.K1 = 1) AND
(((t2i.K1r = t1a.K1 AND t2i.rowTimestamp > t2a.rowTimestamp ) OR
(t2i.rowTimestamp = t2a.rowTimestamp AND t2i.K2 > t2a.K2))
OR (t2i.K2 IS NULL))
WHERE
t2a.K1r = 1 AND t2i.K2 IS NULL;
K1 Name K2 K1r rowTimestamp Event K2B K1rB rowTimestampB EventB
1 T1Row1 3 1 2015-04-13 10:42:12 T1Row1Event3 NULL NULL NULL NULL
EXPLAIN EXTENDED SELECT t1a.*, t2a.*,
t2i.K2 AS K2B, t2i.K1r AS K1rB,
t2i.rowTimestamp AS rowTimestampB, t2i.Event AS EventB
FROM
t1 t1a JOIN t2 t2a ON t2a.K1r = t1a.K1
LEFT JOIN
( t1 t1i LEFT JOIN t2 t2i ON t2i.K1r = t1i.K1)
ON (t1i.K1 = 1) AND
(((t2i.K1r = t1a.K1 AND t2i.rowTimestamp > t2a.rowTimestamp ) OR
(t2i.rowTimestamp = t2a.rowTimestamp AND t2i.K2 > t2a.K2))
OR (t2i.K2 IS NULL))
WHERE
t2a.K1r = 1 AND t2i.K2 IS NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1a const PRIMARY PRIMARY 4 const 1 100.00
1 SIMPLE t2a ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t1i const PRIMARY PRIMARY 4 const 1 100.00 Using index
1 SIMPLE t2i ALL NULL NULL NULL NULL 3 100.00 Using where; Not exists
Warnings:
Note 1003 select 1 AS `K1`,'T1Row1' AS `Name`,`test`.`t2a`.`K2` AS `K2`,`test`.`t2a`.`K1r` AS `K1r`,`test`.`t2a`.`rowTimestamp` AS `rowTimestamp`,`test`.`t2a`.`Event` AS `Event`,`test`.`t2i`.`K2` AS `K2B`,`test`.`t2i`.`K1r` AS `K1rB`,`test`.`t2i`.`rowTimestamp` AS `rowTimestampB`,`test`.`t2i`.`Event` AS `EventB` from `test`.`t1` `t1a` join `test`.`t2` `t2a` left join (`test`.`t1` `t1i` left join `test`.`t2` `t2i` on((`test`.`t2i`.`K1r` = 1))) on(((`test`.`t1i`.`K1` = 1) and (((`test`.`t2i`.`K1r` = 1) and (`test`.`t2i`.`rowTimestamp` > `test`.`t2a`.`rowTimestamp`)) or ((`test`.`t2i`.`rowTimestamp` = `test`.`t2a`.`rowTimestamp`) and (`test`.`t2i`.`K2` > `test`.`t2a`.`K2`)) or isnull(`test`.`t2i`.`K2`)))) where ((`test`.`t2a`.`K1r` = 1) and isnull(`test`.`t2i`.`K2`))
CREATE VIEW v1 AS
SELECT t2i.*
FROM t1 as t1i LEFT JOIN t2 as t2i ON t2i.K1r = t1i.K1
WHERE t1i.K1 = 1 ;
SELECT
t1a.*, t2a.*, t2b.K2 as K2B, t2b.K1r as K1rB,
t2b.rowTimestamp as rowTimestampB, t2b.Event as EventB
FROM
t1 as t1a JOIN t2 as t2a ON t2a.K1r = t1a.K1
LEFT JOIN
v1 as t2b
ON ((t2b.K1r = t1a.K1 AND t2b.rowTimestamp > t2a.rowTimestamp) OR
(t2b.rowTimestamp = t2a.rowTimestamp AND t2b.K2 > t2a.K2))
OR (t2b.K2 IS NULL)
WHERE
t1a.K1 = 1 AND
t2b.K2 IS NULL;
K1 Name K2 K1r rowTimestamp Event K2B K1rB rowTimestampB EventB
1 T1Row1 3 1 2015-04-13 10:42:12 T1Row1Event3 NULL NULL NULL NULL
EXPLAIN EXTENDED SELECT
t1a.*, t2a.*, t2b.K2 as K2B, t2b.K1r as K1rB,
t2b.rowTimestamp as rowTimestampB, t2b.Event as EventB
FROM
t1 as t1a JOIN t2 as t2a ON t2a.K1r = t1a.K1
LEFT JOIN
v1 as t2b
ON ((t2b.K1r = t1a.K1 AND t2b.rowTimestamp > t2a.rowTimestamp) OR
(t2b.rowTimestamp = t2a.rowTimestamp AND t2b.K2 > t2a.K2))
OR (t2b.K2 IS NULL)
WHERE
t1a.K1 = 1 AND
t2b.K2 IS NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1a const PRIMARY PRIMARY 4 const 1 100.00
1 SIMPLE t2a ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t1i const PRIMARY PRIMARY 4 const 1 100.00 Using index
1 SIMPLE t2i ALL NULL NULL NULL NULL 3 100.00 Using where; Not exists
Warnings:
Note 1003 select 1 AS `K1`,'T1Row1' AS `Name`,`t2a`.`K2` AS `K2`,`t2a`.`K1r` AS `K1r`,`t2a`.`rowTimestamp` AS `rowTimestamp`,`t2a`.`Event` AS `Event`,`test`.`t2i`.`K2` AS `K2B`,`test`.`t2i`.`K1r` AS `K1rB`,`test`.`t2i`.`rowTimestamp` AS `rowTimestampB`,`test`.`t2i`.`Event` AS `EventB` from `test`.`t1` `t1a` join `test`.`t2` `t2a` left join (`test`.`t1` `t1i` left join `test`.`t2` `t2i` on((`test`.`t2i`.`K1r` = 1))) on(((`test`.`t1i`.`K1` = 1) and (((`test`.`t2i`.`K1r` = 1) and (`test`.`t2i`.`rowTimestamp` > `t2a`.`rowTimestamp`)) or ((`test`.`t2i`.`rowTimestamp` = `t2a`.`rowTimestamp`) and (`test`.`t2i`.`K2` > `t2a`.`K2`)) or isnull(`test`.`t2i`.`K2`)))) where ((`t2a`.`K1r` = 1) and isnull(`test`.`t2i`.`K2`))
DROP VIEW v1;
DROP TABLE t1,t2;
set optimizer_search_depth= @tmp_mdev621;
CREATE TABLE t5 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b));
CREATE TABLE t6 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b));

View File

@ -5340,3 +5340,4 @@ DELIMITER ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
ALTER DATABASE `a\"'``b` CHARACTER SET utf8 COLLATE utf8_general_ci ;
DROP DATABASE `a\"'``b`;
FOUND /Database: mysql/ in bug11505.sql

View File

@ -732,6 +732,97 @@ SELECT * FROM t1 WHERE d = '1991-01-01';
d
1991-01-01
DROP TABLE t1;
set global default_storage_engine=default;
#
# MDEV-9455: [ERROR] mysqld got signal 11
#
CREATE TABLE `t1` (
`DIARY_TOTAL_DAY_SEQ` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`IMORY_ID` bigint(20) NOT NULL,
`NAME` varchar(75) DEFAULT NULL,
`DATETIME` varchar(10) NOT NULL DEFAULT '',
`DAILY_CALL_CNT` int(11) DEFAULT NULL,
`DAILY_SMS_CNT` int(11) DEFAULT NULL,
`NUMBER` varchar(64) DEFAULT NULL,
`DURATION` varchar(16) DEFAULT NULL,
PRIMARY KEY (`DIARY_TOTAL_DAY_SEQ`,`DATETIME`),
KEY `IDX_t1_01` (`IMORY_ID`,`DATETIME`)
) AUTO_INCREMENT=328702514 DEFAULT CHARSET=utf8mb4
PARTITION BY RANGE COLUMNS(`DATETIME`)
(PARTITION p0 VALUES LESS THAN ('2015-10-01') ENGINE = InnoDB,
PARTITION p1 VALUES LESS THAN ('2015-11-01') ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN ('2015-12-01') ENGINE = InnoDB,
PARTITION p3 VALUES LESS THAN ('2016-01-01') ENGINE = InnoDB,
PARTITION p4 VALUES LESS THAN ('2016-02-01') ENGINE = InnoDB,
PARTITION p5 VALUES LESS THAN ('2016-03-01') ENGINE = InnoDB,
PARTITION p6 VALUES LESS THAN ('2016-04-01') ENGINE = InnoDB,
PARTITION p7 VALUES LESS THAN ('2016-05-01') ENGINE = InnoDB,
PARTITION p8 VALUES LESS THAN ('2016-06-01') ENGINE = InnoDB,
PARTITION p9 VALUES LESS THAN ('2016-07-01') ENGINE = InnoDB,
PARTITION p10 VALUES LESS THAN ('2016-08-01') ENGINE = InnoDB)
;
CREATE TABLE `t2` (
`DIARY_SEQ` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`IMORY_ID` bigint(20) NOT NULL,
`CALL_TYPE` varchar(1) DEFAULT NULL,
`DATA_TYPE` varchar(1) DEFAULT NULL,
`FEATURES` varchar(1) DEFAULT NULL,
`NAME` varchar(75) DEFAULT NULL,
`NUMBER` varchar(64) DEFAULT NULL,
`DATETIME` datetime NOT NULL,
`REG_DATE` datetime NOT NULL,
`TITLE` varchar(50) DEFAULT NULL,
`BODY` varchar(4200) DEFAULT NULL,
`MIME_TYPE` varchar(32) DEFAULT NULL,
`DURATION` varchar(16) DEFAULT NULL,
`DEVICE_ID` varchar(64) DEFAULT NULL,
`DEVICE_NAME` varchar(32) DEFAULT NULL,
PRIMARY KEY (`DIARY_SEQ`,`DATETIME`,`REG_DATE`),
KEY `IDX_TB_DIARY_01` (`IMORY_ID`,`DATETIME`,`CALL_TYPE`,`NUMBER`),
KEY `IDX_TB_DIARY_02` (`REG_DATE`)
) AUTO_INCREMENT=688799006 DEFAULT CHARSET=utf8mb4
PARTITION BY RANGE COLUMNS(REG_DATE)
(PARTITION p0 VALUES LESS THAN ('2015-10-01') ENGINE = InnoDB,
PARTITION p1 VALUES LESS THAN ('2015-11-01') ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN ('2015-12-01') ENGINE = InnoDB,
PARTITION p3 VALUES LESS THAN ('2016-01-01') ENGINE = InnoDB,
PARTITION p4 VALUES LESS THAN ('2016-02-01') ENGINE = InnoDB,
PARTITION p5 VALUES LESS THAN ('2016-03-01') ENGINE = InnoDB,
PARTITION p6 VALUES LESS THAN ('2016-04-01') ENGINE = InnoDB,
PARTITION p7 VALUES LESS THAN ('2016-05-01') ENGINE = InnoDB,
PARTITION p8 VALUES LESS THAN ('2016-06-01') ENGINE = InnoDB,
PARTITION p9 VALUES LESS THAN ('2016-07-01') ENGINE = InnoDB,
PARTITION p10 VALUES LESS THAN ('2016-08-01') ENGINE = InnoDB)
;
SELECT
A.IMORY_ID,
A.NUMBER,
A.NAME,
DATE_FORMAT(A.DATETIME, '%Y-%m-%d') AS TARGET_DATE,
SUM( CASE WHEN A.DATA_TYPE='1' THEN 1 ELSE 0 END) AS CALL_CNT,
SUM( CASE WHEN A.DATA_TYPE IN ('2', '3') THEN 1 ELSE 0 END) AS SMS_CNT,
SUM(CAST(A.DURATION AS INT)) AS DURATION,
( SELECT COUNT(*)
FROM t1
WHERE IMORY_ID=A.IMORY_ID
AND NUMBER=A.NUMBER
AND NAME=A.NAME
AND DATETIME = DATE_FORMAT(A.DATETIME, '%Y-%m-%d')
) STATS_COUNT
FROM t2 A
WHERE A.IMORY_ID = 55094102
AND A.DATETIME LIKE (
SELECT CONCAT (DATE_FORMAT(DATETIME, '%Y-%m-%d') ,'%')
FROM t2
WHERE IMORY_ID=55094102
AND DIARY_SEQ IN ( 608351221, 608351225, 608351229 )
group by DATE_FORMAT(DATETIME, '%Y-%m-%d')
)
GROUP BY A.IMORY_ID, A.NUMBER, A.NAME, DATE_FORMAT(A.DATETIME, '%Y-%m-%d')
;
IMORY_ID NUMBER NAME TARGET_DATE CALL_CNT SMS_CNT DURATION STATS_COUNT
drop table t2, t1;
set global default_storage_engine='innodb';
#
# MDEV-5963: InnoDB: Assertion failure in file row0sel.cc line 2503,
# Failing assertion: 0 with "key ptr now exceeds key end by 762 bytes"

View File

@ -230,6 +230,22 @@ PARTITION pMax VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Partition p1, first row");
DROP TABLE t1;
#
# MDEV-10418 Assertion `m_extra_cache' failed
# in ha_partition::late_extra_cache(uint)
#
CREATE TABLE t1 (f1 INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (f2 INT) ENGINE=MyISAM PARTITION BY RANGE(f2) (PARTITION pmax VALUES LESS THAN MAXVALUE);
INSERT INTO t2 VALUES (8);
CREATE ALGORITHM = MERGE VIEW v AS SELECT f2 FROM t2, t1;
UPDATE v SET f2 = 1;
SELECT * FROM t2;
f2
1
DROP VIEW v;
DROP TABLE t2;
DROP TABLE t1;
#
# bug#11760213-52599: ALTER TABLE REMOVE PARTITIONING ON NON-PARTITIONED
# TABLE CORRUPTS MYISAM
DROP TABLE if exists `t1`;

View File

@ -4107,4 +4107,76 @@ NULL
NULL
deallocate prepare stmt;
drop table t1,t2,t3,t4;
#
# MDEV-11859: the plans for the first and the second executions
# of PS are not the same
#
create table t1 (id int, c varchar(3), key idx(c))engine=myisam;
insert into t1 values (3,'bar'), (1,'xxx'), (2,'foo'), (5,'yyy');
prepare stmt1 from
"explain extended
select * from t1 where (1, 2) in ( select 3, 4 ) or c = 'foo'";
execute stmt1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ref idx idx 6 const 1 100.00 Using index condition
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (`test`.`t1`.`c` = 'foo')
execute stmt1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ref idx idx 6 const 1 100.00 Using index condition
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (`test`.`t1`.`c` = 'foo')
deallocate prepare stmt1;
prepare stmt1 from
"select * from t1 where (1, 2) in ( select 3, 4 ) or c = 'foo'";
flush status;
execute stmt1;
id c
2 foo
show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
Handler_read_last 0
Handler_read_next 1
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
flush status;
execute stmt1;
id c
2 foo
show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
Handler_read_last 0
Handler_read_next 1
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
deallocate prepare stmt1;
prepare stmt2 from
"explain extended
select * from t1 where (1, 2) in ( select 3, 4 )";
execute stmt2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`c` AS `c` from `test`.`t1` where 0
execute stmt2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`c` AS `c` from `test`.`t1` where 0
deallocate prepare stmt2;
drop table t1;
# End of 5.5 tests

View File

@ -60,11 +60,11 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN
SELECT * FROM City
WHERE Population > 100000 AND Name LIKE 'Aba%' OR
Country IN ('CAN', 'ARG') AND ID < 3800 OR
Country < 'U' AND Name LIKE 'Zhu%' OR
ID BETWEEN 3800 AND 3810;
Country IN ('CAN', 'ARG') AND ID BETWEEN 120 AND 130 OR
Country <= 'ALB' AND Name LIKE 'L%' OR
ID BETWEEN 3807 AND 3810;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City index_merge PRIMARY,Population,Country,Name Name,Country,PRIMARY 35,3,4 NULL 132 Using sort_union(Name,Country,PRIMARY); Using where
1 SIMPLE City index_merge PRIMARY,Population,Country,Name Name,PRIMARY,Country 35,4,3 NULL 31 Using sort_union(Name,PRIMARY,Country); Using where
EXPLAIN
SELECT * FROM City
WHERE (Population > 101000 AND Population < 115000);
@ -1769,4 +1769,42 @@ a b
167 9999
168 10000
DROP TABLE t1;
#
# MDEV-8603: Wrong result OR/AND condition over index fields
#
CREATE TABLE t1 (
id INT NOT NULL,
state VARCHAR(64),
capital VARCHAR(64),
UNIQUE KEY (id),
KEY state (state,id),
KEY capital (capital, id)
);
INSERT INTO t1 VALUES
(1,'Arizona','Phoenix'),
(2,'Hawaii','Honolulu'),
(3,'Georgia','Atlanta'),
(4,'Florida','Tallahassee'),
(5,'Alaska','Juneau'),
(6,'Michigan','Lansing'),
(7,'Pennsylvania','Harrisburg'),
(8,'Virginia','Richmond')
;
EXPLAIN
SELECT * FROM t1 FORCE KEY (state,capital)
WHERE ( state = 'Alabama' OR state >= 'Colorado' ) AND id != 9
OR ( capital >= 'Topeka' OR state = 'Kansas' ) AND state != 'Texas';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range state,capital state 71 NULL 12 Using index condition; Using where
SELECT * FROM t1 FORCE KEY (state,capital)
WHERE ( state = 'Alabama' OR state >= 'Colorado' ) AND id != 9
OR ( capital >= 'Topeka' OR state = 'Kansas' ) AND state != 'Texas';
id state capital
4 Florida Tallahassee
3 Georgia Atlanta
2 Hawaii Honolulu
6 Michigan Lansing
7 Pennsylvania Harrisburg
8 Virginia Richmond
DROP TABLE t1;
set session optimizer_switch='index_merge_sort_intersection=default';

View File

@ -61,11 +61,11 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN
SELECT * FROM City
WHERE Population > 100000 AND Name LIKE 'Aba%' OR
Country IN ('CAN', 'ARG') AND ID < 3800 OR
Country < 'U' AND Name LIKE 'Zhu%' OR
ID BETWEEN 3800 AND 3810;
Country IN ('CAN', 'ARG') AND ID BETWEEN 120 AND 130 OR
Country <= 'ALB' AND Name LIKE 'L%' OR
ID BETWEEN 3807 AND 3810;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City index_merge PRIMARY,Population,Country,Name Name,Country,PRIMARY 35,7,4 NULL 123 Using sort_union(Name,Country,PRIMARY); Using where
1 SIMPLE City index_merge PRIMARY,Population,Country,Name Name,Country,PRIMARY 35,3,4 NULL 33 Using sort_union(Name,Country,PRIMARY); Using where
EXPLAIN
SELECT * FROM City
WHERE (Population > 101000 AND Population < 115000);
@ -369,7 +369,7 @@ WHERE ((ID < 200) AND (Name LIKE 'Ha%' OR (Country > 'A' AND Country < 'ARG')))
OR ((ID BETWEEN 100 AND 200) AND
(Name LIKE 'Pa%' OR (Population > 103000 AND Population < 104000)));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City range PRIMARY,Population,Country,Name PRIMARY 4 NULL 200 Using where
1 SIMPLE City index_merge PRIMARY,Population,Country,Name Name,Population,PRIMARY 39,4,4 NULL 305 Using sort_union(Name,Population,PRIMARY); Using where
SELECT * FROM City USE INDEX ()
WHERE ((ID < 10) AND (Name LIKE 'H%' OR (Country > 'A' AND Country < 'ARG')))
OR ((ID BETWEEN 100 AND 110) AND
@ -1770,5 +1770,43 @@ a b
167 9999
168 10000
DROP TABLE t1;
#
# MDEV-8603: Wrong result OR/AND condition over index fields
#
CREATE TABLE t1 (
id INT NOT NULL,
state VARCHAR(64),
capital VARCHAR(64),
UNIQUE KEY (id),
KEY state (state,id),
KEY capital (capital, id)
);
INSERT INTO t1 VALUES
(1,'Arizona','Phoenix'),
(2,'Hawaii','Honolulu'),
(3,'Georgia','Atlanta'),
(4,'Florida','Tallahassee'),
(5,'Alaska','Juneau'),
(6,'Michigan','Lansing'),
(7,'Pennsylvania','Harrisburg'),
(8,'Virginia','Richmond')
;
EXPLAIN
SELECT * FROM t1 FORCE KEY (state,capital)
WHERE ( state = 'Alabama' OR state >= 'Colorado' ) AND id != 9
OR ( capital >= 'Topeka' OR state = 'Kansas' ) AND state != 'Texas';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range state,capital state 71 NULL 10 Using index condition; Using where
SELECT * FROM t1 FORCE KEY (state,capital)
WHERE ( state = 'Alabama' OR state >= 'Colorado' ) AND id != 9
OR ( capital >= 'Topeka' OR state = 'Kansas' ) AND state != 'Texas';
id state capital
4 Florida Tallahassee
3 Georgia Atlanta
2 Hawaii Honolulu
6 Michigan Lansing
7 Pennsylvania Harrisburg
8 Virginia Richmond
DROP TABLE t1;
set session optimizer_switch='index_merge_sort_intersection=default';
SET SESSION STORAGE_ENGINE=DEFAULT;

View File

@ -0,0 +1,39 @@
set default_storage_engine=Aria;
call mtr.add_suppression("File.*t1.* not found");
create table mysql.t1 (a int, b char(16), index(a));
insert mysql.t1 values (100, 'test'),(101,'test');
create table t1 (a int, b char(16), index(a))
data directory="MYSQLTEST_VARDIR/tmp/foo";
insert t1 values (200, 'some'),(201,'some');
select * from t1;
a b
200 some
201 some
flush tables;
set debug_sync='mi_open_datafile SIGNAL ok WAIT_FOR go';
select * from t1;
set debug_sync='now WAIT_FOR ok';
set debug_sync='now SIGNAL go';
ERROR HY000: File 'MYSQLTEST_VARDIR/tmp/foo/t1.MAD' not found (Errcode: 20 "Not a directory")
flush tables;
drop table if exists t1;
create table t1 (a int, b char(16), index (a))
index directory="MYSQLTEST_VARDIR/tmp/foo";
insert t1 values (200, 'some'),(201,'some');
explain select a from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL a 5 NULL 2 Using index
select a from t1;
a
200
201
flush tables;
set debug_sync='mi_open_kfile SIGNAL waiting WAIT_FOR run';
select a from t1;
set debug_sync='now WAIT_FOR waiting';
set debug_sync='now SIGNAL run';
ERROR HY000: Can't find file: './test/t1.MAI' (errno: 20 "Not a directory")
flush tables;
drop table if exists t1;
drop table mysql.t1;
set debug_sync='RESET';

View File

@ -0,0 +1,38 @@
call mtr.add_suppression("File.*t1.* not found");
create table mysql.t1 (a int, b char(16), index(a));
insert mysql.t1 values (100, 'test'),(101,'test');
create table t1 (a int, b char(16), index(a))
data directory="MYSQLTEST_VARDIR/tmp/foo";
insert t1 values (200, 'some'),(201,'some');
select * from t1;
a b
200 some
201 some
flush tables;
set debug_sync='mi_open_datafile SIGNAL ok WAIT_FOR go';
select * from t1;
set debug_sync='now WAIT_FOR ok';
set debug_sync='now SIGNAL go';
ERROR HY000: File 'MYSQLTEST_VARDIR/tmp/foo/t1.MYD' not found (Errcode: 20 "Not a directory")
flush tables;
drop table if exists t1;
create table t1 (a int, b char(16), index (a))
index directory="MYSQLTEST_VARDIR/tmp/foo";
insert t1 values (200, 'some'),(201,'some');
explain select a from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL a 5 NULL 2 Using index
select a from t1;
a
200
201
flush tables;
set debug_sync='mi_open_kfile SIGNAL waiting WAIT_FOR run';
select a from t1;
set debug_sync='now WAIT_FOR waiting';
set debug_sync='now SIGNAL run';
ERROR HY000: Can't find file: './test/t1.MYI' (errno: 20 "Not a directory")
flush tables;
drop table if exists t1;
drop table mysql.t1;
set debug_sync='RESET';

View File

@ -598,6 +598,7 @@ INSERT IGNORE INTO t1 VALUES (0,'g');
CREATE TABLE t3 ( a varchar(1)) ;
INSERT IGNORE INTO t3 VALUES ('g');
CREATE TABLE t2 ( a int(11) NOT NULL, PRIMARY KEY (a));
INSERT INTO t2 VALUES (9), (10);
create view v1 as SELECT t1.* FROM t1 LEFT JOIN t2 ON ( t1.a = t2.a ) WHERE t2.a <> 0;
SELECT alias1.* FROM t3 LEFT JOIN v1 as alias1 ON ( t3.a = alias1.b );
a b
@ -606,7 +607,7 @@ EXPLAIN SELECT alias1.* FROM t3 LEFT JOIN v1 as alias1 ON ( t3.a = alias1.b );
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 system NULL NULL NULL NULL 1
1 SIMPLE t1 ALL NULL NULL NULL NULL 1 Using where
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where; Using index
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index
drop view v1;
DROP TABLE t1,t2,t3;
#

View File

@ -5536,6 +5536,89 @@ Warnings:
Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
drop view v1;
drop table t1,t2;
#
# MDEV-12099: usage of mergeable view with LEFT JOIN
# that can be converted to INNER JOIN
#
create table t1 (a int, b int, key(a)) engine=myisam;
insert into t1 values
(3,20), (7,10), (2,10), (4,30), (8,70),
(7,70), (9,100), (9,60), (8,80), (7,60);
create table t2 (c int, d int, key (c)) engine=myisam;
insert into t2 values
(50,100), (20, 200), (10,300),
(150,100), (120, 200), (110,300),
(250,100), (220, 200), (210,300);
create table t3(e int, f int not null, key(e), unique (f)) engine=myisam;
insert into t3 values
(100, 3), (300, 5), (400, 4), (300,7),
(300,2), (600, 13), (800, 15), (700, 14),
(600, 23), (800, 25), (700, 24);
create view v1 as
select * from t2 left join t3 on t3.e=t2.d where t3.f is not null;
select *
from t1 left join v1 on v1.c=t1.b
where t1.a < 5;
a b c d e f
2 10 10 300 300 5
2 10 10 300 300 7
2 10 10 300 300 2
3 20 NULL NULL NULL NULL
4 30 NULL NULL NULL NULL
select *
from t1 left join ( t2 left join t3 on t3.e=t2.d )
on t2.c=t1.b and t3.f is not null
where t1.a < 5;
a b c d e f
2 10 10 300 300 5
2 10 10 300 300 7
2 10 10 300 300 2
3 20 NULL NULL NULL NULL
4 30 NULL NULL NULL NULL
explain extended
select *
from t1 left join v1 on v1.c=t1.b
where t1.a < 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range a a 5 NULL 3 100.00 Using index condition
1 SIMPLE t2 ref c c 5 test.t1.b 2 100.00 Using where
1 SIMPLE t3 ref f,e e 5 test.t2.d 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`c` = `test`.`t1`.`b`) and (`test`.`t3`.`e` = `test`.`t2`.`d`) and (`test`.`t3`.`f` is not null) and (`test`.`t1`.`b` is not null) and (`test`.`t2`.`d` is not null))) where (`test`.`t1`.`a` < 5)
explain extended
select *
from t1 left join ( t2 left join t3 on t3.e=t2.d )
on t2.c=t1.b and t3.f is not null
where t1.a < 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range a a 5 NULL 3 100.00 Using index condition
1 SIMPLE t2 ref c c 5 test.t1.b 2 100.00 Using where
1 SIMPLE t3 ref f,e e 5 test.t2.d 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`c` = `test`.`t1`.`b`) and (`test`.`t3`.`e` = `test`.`t2`.`d`) and (`test`.`t3`.`f` is not null) and (`test`.`t1`.`b` is not null) and (`test`.`t2`.`d` is not null))) where (`test`.`t1`.`a` < 5)
explain extended
select *
from t1 left join v1 on v1.c=t1.b and v1.f=t1.a
where t1.a < 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range a a 5 NULL 3 100.00 Using index condition
1 SIMPLE t3 eq_ref f,e f 4 test.t1.a 1 100.00 Using where
1 SIMPLE t2 ref c c 5 test.t1.b 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`c` = `test`.`t1`.`b`) and (`test`.`t3`.`f` = `test`.`t1`.`a`) and (`test`.`t2`.`d` = `test`.`t3`.`e`) and (`test`.`t1`.`a` is not null) and (`test`.`t1`.`a` is not null) and (`test`.`t1`.`b` is not null))) where (`test`.`t1`.`a` < 5)
explain extended
select *
from t1 left join ( t2 left join t3 on t3.e=t2.d )
on t2.c=t1.b and t3.f=t1.a and t3.f is not null
where t1.a < 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range a a 5 NULL 3 100.00 Using index condition
1 SIMPLE t3 eq_ref f,e f 4 test.t1.a 1 100.00 Using where
1 SIMPLE t2 ref c c 5 test.t1.b 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`c` = `test`.`t1`.`b`) and (`test`.`t3`.`f` = `test`.`t1`.`a`) and (`test`.`t2`.`d` = `test`.`t3`.`e`) and (`test`.`t1`.`a` is not null) and (`test`.`t1`.`a` is not null) and (`test`.`t1`.`b` is not null))) where (`test`.`t1`.`a` < 5)
drop view v1;
drop table t1,t2,t3;
# -----------------------------------------------------------------
# -- End of 5.5 tests.
# -----------------------------------------------------------------

View File

@ -61,6 +61,7 @@ let $MYSQLD_DATADIR= `SELECT @@datadir`;
--echo #
--echo # Trigger a MyISAM system error during an INFORMATION_SCHEMA.TABLES query
--echo #
--replace_result 20 2
SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, TABLE_ROWS, DATA_LENGTH, TABLE_COMMENT
FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';

View File

@ -0,0 +1,121 @@
create table t1 (a bigint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612), (1), (2), (65535);
select * from t1;
a
1
18446744073709551612
18446744073709551613
18446744073709551614
18446744073709551615
2
65535
select * from t1 where a=-2;
a
delete from t1 where a=-2;
select * from t1;
a
1
18446744073709551612
18446744073709551613
18446744073709551614
18446744073709551615
2
65535
select * from t1 where a=18446744073709551615;
a
18446744073709551615
delete from t1 where a=18446744073709551615;
select * from t1;
a
1
18446744073709551612
18446744073709551613
18446744073709551614
2
65535
drop table t1;
create table t2 (a bigint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612);
select * from t2;
a
18446744073709551612
18446744073709551613
18446744073709551614
18446744073709551615
select * from t2 where a=18446744073709551615;
a
18446744073709551615
delete from t2 where a=18446744073709551615;
select * from t2;
a
18446744073709551612
18446744073709551613
18446744073709551614
delete from t2;
1024 inserts;
select count(*) from t2;
count(*)
1024
drop table t2;
create table t3 (a bigint not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` bigint(20) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (9223372036854775807), (9223372036854775806), (9223372036854775805), (9223372036854775804), (-9223372036854775808), (-9223372036854775807), (1), (-1), (0);
select * from t3;
a
-1
-9223372036854775807
-9223372036854775808
0
1
9223372036854775804
9223372036854775805
9223372036854775806
9223372036854775807
select * from t3 where a=9223372036854775806;
a
9223372036854775806
delete from t3 where a=9223372036854775806;
select * from t3;
a
-1
-9223372036854775807
-9223372036854775808
0
1
9223372036854775804
9223372036854775805
9223372036854775807
drop table t3;

View File

@ -0,0 +1,121 @@
create table t1 (a bigint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612), (1), (2), (65535);
select * from t1;
a
1
18446744073709551612
18446744073709551613
18446744073709551614
18446744073709551615
2
65535
select * from t1 where a=-2;
a
delete from t1 where a=-2;
select * from t1;
a
1
18446744073709551612
18446744073709551613
18446744073709551614
18446744073709551615
2
65535
select * from t1 where a=18446744073709551615;
a
18446744073709551615
delete from t1 where a=18446744073709551615;
select * from t1;
a
1
18446744073709551612
18446744073709551613
18446744073709551614
2
65535
drop table t1;
create table t2 (a bigint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612);
select * from t2;
a
18446744073709551612
18446744073709551613
18446744073709551614
18446744073709551615
select * from t2 where a=18446744073709551615;
a
18446744073709551615
delete from t2 where a=18446744073709551615;
select * from t2;
a
18446744073709551612
18446744073709551613
18446744073709551614
delete from t2;
65535 inserts;
select count(*) from t2;
count(*)
65535
drop table t2;
create table t3 (a bigint not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` bigint(20) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (9223372036854775807), (9223372036854775806), (9223372036854775805), (9223372036854775804), (-9223372036854775808), (-9223372036854775807), (1), (-1), (0);
select * from t3;
a
-1
-9223372036854775807
-9223372036854775808
0
1
9223372036854775804
9223372036854775805
9223372036854775806
9223372036854775807
select * from t3 where a=9223372036854775806;
a
9223372036854775806
delete from t3 where a=9223372036854775806;
select * from t3;
a
-1
-9223372036854775807
-9223372036854775808
0
1
9223372036854775804
9223372036854775805
9223372036854775807
drop table t3;

View File

@ -0,0 +1,82 @@
create table t1 (a double not null, primary key(a)) engine='InnoDB'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` double NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */
insert into t1 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208);
select * from t1;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1.5
1234.567
2.2250738585072016e208
select * from t1 where a=1.5;
a
1.5
delete from t1 where a=1.5;
select * from t1;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1234.567
2.2250738585072016e208
drop table t1;
create table t2 (a double not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 10;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` double NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 10 */
insert into t2 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208);
select * from t2;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1.5
1234.567
2.2250738585072016e208
select * from t2 where a=1234.567;
a
1234.567
delete from t2 where a=1234.567;
select * from t2;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1.5
2.2250738585072016e208
delete from t2;
1024*3 inserts;
select count(*) from t2;
count(*)
3072
drop table t2;

View File

@ -0,0 +1,82 @@
create table t1 (a double not null, primary key(a)) engine='MYISAM'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` double NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */
insert into t1 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208);
select * from t1;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1.5
1234.567
2.2250738585072016e208
select * from t1 where a=1.5;
a
1.5
delete from t1 where a=1.5;
select * from t1;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1234.567
2.2250738585072016e208
drop table t1;
create table t2 (a double not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 10;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` double NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 10 */
insert into t2 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208);
select * from t2;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1.5
1234.567
2.2250738585072016e208
select * from t2 where a=1234.567;
a
1234.567
delete from t2 where a=1234.567;
select * from t2;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1.5
2.2250738585072016e208
delete from t2;
16384*3 inserts;
select count(*) from t2;
count(*)
49152
drop table t2;

View File

@ -88,85 +88,3 @@ select count(*) from t2;
count(*)
3072
drop table t2;
create table t1 (a double not null, primary key(a)) engine='InnoDB'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` double NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */
insert into t1 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208);
select * from t1;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1.5
1234.567
2.2250738585072016e208
select * from t1 where a=1.5;
a
1.5
delete from t1 where a=1.5;
select * from t1;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1234.567
2.2250738585072016e208
drop table t1;
create table t2 (a double not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 10;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` double NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 10 */
insert into t2 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208);
select * from t2;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1.5
1234.567
2.2250738585072016e208
select * from t2 where a=1234.567;
a
1234.567
delete from t2 where a=1234.567;
select * from t2;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1.5
2.2250738585072016e208
delete from t2;
1024*3 inserts;
select count(*) from t2;
count(*)
3072
drop table t2;

View File

@ -88,85 +88,3 @@ select count(*) from t2;
count(*)
49152
drop table t2;
create table t1 (a double not null, primary key(a)) engine='MYISAM'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` double NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */
insert into t1 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208);
select * from t1;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1.5
1234.567
2.2250738585072016e208
select * from t1 where a=1.5;
a
1.5
delete from t1 where a=1.5;
select * from t1;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1234.567
2.2250738585072016e208
drop table t1;
create table t2 (a double not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 10;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` double NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 10 */
insert into t2 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208);
select * from t2;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1.5
1234.567
2.2250738585072016e208
select * from t2 where a=1234.567;
a
1234.567
delete from t2 where a=1234.567;
select * from t2;
a
-2.2250738585072016e208
-1.5
-1
-2.2250738585072014e-208
0
1.5
2.2250738585072016e208
delete from t2;
16384*3 inserts;
select count(*) from t2;
count(*)
49152
drop table t2;

View File

@ -1,221 +1,3 @@
create table t1 (a tinyint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` tinyint(3) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */
insert into t1 values (255), (254), (253), (252), (1), (2), (128);
select * from t1;
a
1
128
2
252
253
254
255
select * from t1 where a=253;
a
253
delete from t1 where a=253;
select * from t1;
a
1
128
2
252
254
255
drop table t1;
create table t2 (a tinyint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` tinyint(3) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (255), (254), (253), (252);
select * from t2;
a
252
253
254
255
select * from t2 where a=253;
a
253
delete from t2 where a=253;
select * from t2;
a
252
254
255
delete from t2;
255 inserts;
select count(*) from t2;
count(*)
255
drop table t2;
create table t3 (a tinyint not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` tinyint(4) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (127), (126), (125), (124), (-128), (-127), (1), (-1), (0);
select * from t3;
a
-1
-127
-128
0
1
124
125
126
127
select * from t3 where a=125;
a
125
delete from t3 where a=125;
select * from t3;
a
-1
-127
-128
0
1
124
126
127
drop table t3;
create table t1 (a smallint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` smallint(5) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */
insert into t1 values (65535), (65534), (65533), (65532), (1), (2), (256);
select * from t1;
a
1
2
256
65532
65533
65534
65535
select * from t1 where a=65533;
a
65533
delete from t1 where a=65533;
select * from t1;
a
1
2
256
65532
65534
65535
drop table t1;
create table t2 (a smallint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` smallint(5) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (65535), (65534), (65533), (65532);
select * from t2;
a
65532
65533
65534
65535
select * from t2 where a=65533;
a
65533
delete from t2 where a=65533;
select * from t2;
a
65532
65534
65535
delete from t2;
1024 inserts;
select count(*) from t2;
count(*)
1024
drop table t2;
create table t3 (a smallint not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` smallint(6) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (32767), (32766), (32765), (32764), (-32768), (-32767), (1), (-1), (0);
select * from t3;
a
-1
-32767
-32768
0
1
32764
32765
32766
32767
select * from t3 where a=32765;
a
32765
delete from t3 where a=32765;
select * from t3;
a
-1
-32767
-32768
0
1
32764
32766
32767
drop table t3;
create table t1 (a int unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
@ -325,233 +107,3 @@ a
2147483646
2147483647
drop table t3;
create table t1 (a mediumint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` mediumint(8) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */
insert into t1 values (16777215), (16777214), (16777213), (16777212), (1), (2), (65535);
select * from t1;
a
1
16777212
16777213
16777214
16777215
2
65535
select * from t1 where a=16777213;
a
16777213
delete from t1 where a=16777213;
select * from t1;
a
1
16777212
16777214
16777215
2
65535
drop table t1;
create table t2 (a mediumint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` mediumint(8) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (16777215), (16777214), (16777213), (16777212);
select * from t2;
a
16777212
16777213
16777214
16777215
select * from t2 where a=16777213;
a
16777213
delete from t2 where a=16777213;
select * from t2;
a
16777212
16777214
16777215
delete from t2;
1024 inserts;
select count(*) from t2;
count(*)
1024
drop table t2;
create table t3 (a mediumint not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` mediumint(9) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (8388607), (8388606), (8388605), (8388604), (-8388608), (-8388607), (1), (-1), (0);
select * from t3;
a
-1
-8388607
-8388608
0
1
8388604
8388605
8388606
8388607
select * from t3 where a=8388605;
a
8388605
delete from t3 where a=8388605;
select * from t3;
a
-1
-8388607
-8388608
0
1
8388604
8388606
8388607
drop table t3;
create table t1 (a bigint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612), (1), (2), (65535);
select * from t1;
a
1
18446744073709551612
18446744073709551613
18446744073709551614
18446744073709551615
2
65535
select * from t1 where a=-2;
a
delete from t1 where a=-2;
select * from t1;
a
1
18446744073709551612
18446744073709551613
18446744073709551614
18446744073709551615
2
65535
select * from t1 where a=18446744073709551615;
a
18446744073709551615
delete from t1 where a=18446744073709551615;
select * from t1;
a
1
18446744073709551612
18446744073709551613
18446744073709551614
2
65535
drop table t1;
create table t2 (a bigint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612);
select * from t2;
a
18446744073709551612
18446744073709551613
18446744073709551614
18446744073709551615
select * from t2 where a=18446744073709551615;
a
18446744073709551615
delete from t2 where a=18446744073709551615;
select * from t2;
a
18446744073709551612
18446744073709551613
18446744073709551614
delete from t2;
1024 inserts;
select count(*) from t2;
count(*)
1024
drop table t2;
create table t3 (a bigint not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` bigint(20) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (9223372036854775807), (9223372036854775806), (9223372036854775805), (9223372036854775804), (-9223372036854775808), (-9223372036854775807), (1), (-1), (0);
select * from t3;
a
-1
-9223372036854775807
-9223372036854775808
0
1
9223372036854775804
9223372036854775805
9223372036854775806
9223372036854775807
select * from t3 where a=9223372036854775806;
a
9223372036854775806
delete from t3 where a=9223372036854775806;
select * from t3;
a
-1
-9223372036854775807
-9223372036854775808
0
1
9223372036854775804
9223372036854775805
9223372036854775807
drop table t3;

View File

@ -1,221 +1,3 @@
create table t1 (a tinyint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` tinyint(3) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */
insert into t1 values (255), (254), (253), (252), (1), (2), (128);
select * from t1;
a
1
128
2
252
253
254
255
select * from t1 where a=253;
a
253
delete from t1 where a=253;
select * from t1;
a
1
128
2
252
254
255
drop table t1;
create table t2 (a tinyint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` tinyint(3) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (255), (254), (253), (252);
select * from t2;
a
252
253
254
255
select * from t2 where a=253;
a
253
delete from t2 where a=253;
select * from t2;
a
252
254
255
delete from t2;
255 inserts;
select count(*) from t2;
count(*)
255
drop table t2;
create table t3 (a tinyint not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` tinyint(4) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (127), (126), (125), (124), (-128), (-127), (1), (-1), (0);
select * from t3;
a
-1
-127
-128
0
1
124
125
126
127
select * from t3 where a=125;
a
125
delete from t3 where a=125;
select * from t3;
a
-1
-127
-128
0
1
124
126
127
drop table t3;
create table t1 (a smallint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` smallint(5) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */
insert into t1 values (65535), (65534), (65533), (65532), (1), (2), (256);
select * from t1;
a
1
2
256
65532
65533
65534
65535
select * from t1 where a=65533;
a
65533
delete from t1 where a=65533;
select * from t1;
a
1
2
256
65532
65534
65535
drop table t1;
create table t2 (a smallint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` smallint(5) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (65535), (65534), (65533), (65532);
select * from t2;
a
65532
65533
65534
65535
select * from t2 where a=65533;
a
65533
delete from t2 where a=65533;
select * from t2;
a
65532
65534
65535
delete from t2;
65535 inserts;
select count(*) from t2;
count(*)
65535
drop table t2;
create table t3 (a smallint not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` smallint(6) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (32767), (32766), (32765), (32764), (-32768), (-32767), (1), (-1), (0);
select * from t3;
a
-1
-32767
-32768
0
1
32764
32765
32766
32767
select * from t3 where a=32765;
a
32765
delete from t3 where a=32765;
select * from t3;
a
-1
-32767
-32768
0
1
32764
32766
32767
drop table t3;
create table t1 (a int unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
@ -325,233 +107,3 @@ a
2147483646
2147483647
drop table t3;
create table t1 (a mediumint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` mediumint(8) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */
insert into t1 values (16777215), (16777214), (16777213), (16777212), (1), (2), (65535);
select * from t1;
a
1
16777212
16777213
16777214
16777215
2
65535
select * from t1 where a=16777213;
a
16777213
delete from t1 where a=16777213;
select * from t1;
a
1
16777212
16777214
16777215
2
65535
drop table t1;
create table t2 (a mediumint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` mediumint(8) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (16777215), (16777214), (16777213), (16777212);
select * from t2;
a
16777212
16777213
16777214
16777215
select * from t2 where a=16777213;
a
16777213
delete from t2 where a=16777213;
select * from t2;
a
16777212
16777214
16777215
delete from t2;
65535 inserts;
select count(*) from t2;
count(*)
65535
drop table t2;
create table t3 (a mediumint not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` mediumint(9) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (8388607), (8388606), (8388605), (8388604), (-8388608), (-8388607), (1), (-1), (0);
select * from t3;
a
-1
-8388607
-8388608
0
1
8388604
8388605
8388606
8388607
select * from t3 where a=8388605;
a
8388605
delete from t3 where a=8388605;
select * from t3;
a
-1
-8388607
-8388608
0
1
8388604
8388606
8388607
drop table t3;
create table t1 (a bigint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612), (1), (2), (65535);
select * from t1;
a
1
18446744073709551612
18446744073709551613
18446744073709551614
18446744073709551615
2
65535
select * from t1 where a=-2;
a
delete from t1 where a=-2;
select * from t1;
a
1
18446744073709551612
18446744073709551613
18446744073709551614
18446744073709551615
2
65535
select * from t1 where a=18446744073709551615;
a
18446744073709551615
delete from t1 where a=18446744073709551615;
select * from t1;
a
1
18446744073709551612
18446744073709551613
18446744073709551614
2
65535
drop table t1;
create table t2 (a bigint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612);
select * from t2;
a
18446744073709551612
18446744073709551613
18446744073709551614
18446744073709551615
select * from t2 where a=18446744073709551615;
a
18446744073709551615
delete from t2 where a=18446744073709551615;
select * from t2;
a
18446744073709551612
18446744073709551613
18446744073709551614
delete from t2;
65535 inserts;
select count(*) from t2;
count(*)
65535
drop table t2;
create table t3 (a bigint not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` bigint(20) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (9223372036854775807), (9223372036854775806), (9223372036854775805), (9223372036854775804), (-9223372036854775808), (-9223372036854775807), (1), (-1), (0);
select * from t3;
a
-1
-9223372036854775807
-9223372036854775808
0
1
9223372036854775804
9223372036854775805
9223372036854775806
9223372036854775807
select * from t3 where a=9223372036854775806;
a
9223372036854775806
delete from t3 where a=9223372036854775806;
select * from t3;
a
-1
-9223372036854775807
-9223372036854775808
0
1
9223372036854775804
9223372036854775805
9223372036854775807
drop table t3;

View File

@ -0,0 +1,109 @@
create table t1 (a mediumint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` mediumint(8) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */
insert into t1 values (16777215), (16777214), (16777213), (16777212), (1), (2), (65535);
select * from t1;
a
1
16777212
16777213
16777214
16777215
2
65535
select * from t1 where a=16777213;
a
16777213
delete from t1 where a=16777213;
select * from t1;
a
1
16777212
16777214
16777215
2
65535
drop table t1;
create table t2 (a mediumint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` mediumint(8) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (16777215), (16777214), (16777213), (16777212);
select * from t2;
a
16777212
16777213
16777214
16777215
select * from t2 where a=16777213;
a
16777213
delete from t2 where a=16777213;
select * from t2;
a
16777212
16777214
16777215
delete from t2;
1024 inserts;
select count(*) from t2;
count(*)
1024
drop table t2;
create table t3 (a mediumint not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` mediumint(9) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (8388607), (8388606), (8388605), (8388604), (-8388608), (-8388607), (1), (-1), (0);
select * from t3;
a
-1
-8388607
-8388608
0
1
8388604
8388605
8388606
8388607
select * from t3 where a=8388605;
a
8388605
delete from t3 where a=8388605;
select * from t3;
a
-1
-8388607
-8388608
0
1
8388604
8388606
8388607
drop table t3;

View File

@ -0,0 +1,109 @@
create table t1 (a mediumint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` mediumint(8) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */
insert into t1 values (16777215), (16777214), (16777213), (16777212), (1), (2), (65535);
select * from t1;
a
1
16777212
16777213
16777214
16777215
2
65535
select * from t1 where a=16777213;
a
16777213
delete from t1 where a=16777213;
select * from t1;
a
1
16777212
16777214
16777215
2
65535
drop table t1;
create table t2 (a mediumint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` mediumint(8) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (16777215), (16777214), (16777213), (16777212);
select * from t2;
a
16777212
16777213
16777214
16777215
select * from t2 where a=16777213;
a
16777213
delete from t2 where a=16777213;
select * from t2;
a
16777212
16777214
16777215
delete from t2;
65535 inserts;
select count(*) from t2;
count(*)
65535
drop table t2;
create table t3 (a mediumint not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` mediumint(9) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (8388607), (8388606), (8388605), (8388604), (-8388608), (-8388607), (1), (-1), (0);
select * from t3;
a
-1
-8388607
-8388608
0
1
8388604
8388605
8388606
8388607
select * from t3 where a=8388605;
a
8388605
delete from t3 where a=8388605;
select * from t3;
a
-1
-8388607
-8388608
0
1
8388604
8388606
8388607
drop table t3;

View File

@ -0,0 +1,109 @@
create table t1 (a smallint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` smallint(5) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */
insert into t1 values (65535), (65534), (65533), (65532), (1), (2), (256);
select * from t1;
a
1
2
256
65532
65533
65534
65535
select * from t1 where a=65533;
a
65533
delete from t1 where a=65533;
select * from t1;
a
1
2
256
65532
65534
65535
drop table t1;
create table t2 (a smallint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` smallint(5) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (65535), (65534), (65533), (65532);
select * from t2;
a
65532
65533
65534
65535
select * from t2 where a=65533;
a
65533
delete from t2 where a=65533;
select * from t2;
a
65532
65534
65535
delete from t2;
1024 inserts;
select count(*) from t2;
count(*)
1024
drop table t2;
create table t3 (a smallint not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` smallint(6) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (32767), (32766), (32765), (32764), (-32768), (-32767), (1), (-1), (0);
select * from t3;
a
-1
-32767
-32768
0
1
32764
32765
32766
32767
select * from t3 where a=32765;
a
32765
delete from t3 where a=32765;
select * from t3;
a
-1
-32767
-32768
0
1
32764
32766
32767
drop table t3;

View File

@ -0,0 +1,109 @@
create table t1 (a smallint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` smallint(5) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */
insert into t1 values (65535), (65534), (65533), (65532), (1), (2), (256);
select * from t1;
a
1
2
256
65532
65533
65534
65535
select * from t1 where a=65533;
a
65533
delete from t1 where a=65533;
select * from t1;
a
1
2
256
65532
65534
65535
drop table t1;
create table t2 (a smallint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` smallint(5) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (65535), (65534), (65533), (65532);
select * from t2;
a
65532
65533
65534
65535
select * from t2 where a=65533;
a
65533
delete from t2 where a=65533;
select * from t2;
a
65532
65534
65535
delete from t2;
65535 inserts;
select count(*) from t2;
count(*)
65535
drop table t2;
create table t3 (a smallint not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` smallint(6) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (32767), (32766), (32765), (32764), (-32768), (-32767), (1), (-1), (0);
select * from t3;
a
-1
-32767
-32768
0
1
32764
32765
32766
32767
select * from t3 where a=32765;
a
32765
delete from t3 where a=32765;
select * from t3;
a
-1
-32767
-32768
0
1
32764
32766
32767
drop table t3;

View File

@ -0,0 +1,109 @@
create table t1 (a tinyint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` tinyint(3) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */
insert into t1 values (255), (254), (253), (252), (1), (2), (128);
select * from t1;
a
1
128
2
252
253
254
255
select * from t1 where a=253;
a
253
delete from t1 where a=253;
select * from t1;
a
1
128
2
252
254
255
drop table t1;
create table t2 (a tinyint unsigned not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` tinyint(3) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (255), (254), (253), (252);
select * from t2;
a
252
253
254
255
select * from t2 where a=253;
a
253
delete from t2 where a=253;
select * from t2;
a
252
254
255
delete from t2;
255 inserts;
select count(*) from t2;
count(*)
255
drop table t2;
create table t3 (a tinyint not null, primary key(a)) engine='InnoDB'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` tinyint(4) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (127), (126), (125), (124), (-128), (-127), (1), (-1), (0);
select * from t3;
a
-1
-127
-128
0
1
124
125
126
127
select * from t3 where a=125;
a
125
delete from t3 where a=125;
select * from t3;
a
-1
-127
-128
0
1
124
126
127
drop table t3;

View File

@ -0,0 +1,109 @@
create table t1 (a tinyint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) (
partition pa1 max_rows=20 min_rows=2,
partition pa2 max_rows=30 min_rows=3,
partition pa3 max_rows=30 min_rows=4,
partition pa4 max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` tinyint(3) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */
insert into t1 values (255), (254), (253), (252), (1), (2), (128);
select * from t1;
a
1
128
2
252
253
254
255
select * from t1 where a=253;
a
253
delete from t1 where a=253;
select * from t1;
a
1
128
2
252
254
255
drop table t1;
create table t2 (a tinyint unsigned not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 8;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` tinyint(3) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 8 */
insert into t2 values (255), (254), (253), (252);
select * from t2;
a
252
253
254
255
select * from t2 where a=253;
a
253
delete from t2 where a=253;
select * from t2;
a
252
254
255
delete from t2;
255 inserts;
select count(*) from t2;
count(*)
255
drop table t2;
create table t3 (a tinyint not null, primary key(a)) engine='MYISAM'
partition by key (a) partitions 7;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` tinyint(4) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a)
PARTITIONS 7 */
insert into t3 values (127), (126), (125), (124), (-128), (-127), (1), (-1), (0);
select * from t3;
a
-1
-127
-128
0
1
124
125
126
127
select * from t3 where a=125;
a
125
delete from t3 where a=125;
select * from t3;
a
-1
-127
-128
0
1
124
126
127
drop table t3;

View File

@ -0,0 +1,46 @@
################################################################################
# t/partition_bigint_innodb.test #
# #
# Purpose: #
# Tests around integer type #
# INNODB branch #
# #
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: Elena Stepanova #
# Change Date: 2017-02-18 #
# Change: The test file is spawned from the mega-test partition_int_innodb #
################################################################################
#
# NOTE: PLEASE DO NOT ADD NOT INNODB SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# Please read the README at the end of inc/partition.pre before changing
# any of the variables.
#
#------------------------------------------------------------------------------#
# General not engine specific settings and requirements
##### Options, for debugging support #####
let $debug= 0;
# The server must support partitioning.
--source include/have_partition.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
##### Storage engine to be tested
--source include/have_innodb.inc
let $engine= 'InnoDB';
##### max rows to be inserted
let $maxrows=1024;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_bigint.inc

View File

@ -0,0 +1,46 @@
################################################################################
# t/partition_bigint_myisam.test #
# #
# Purpose: #
# Tests around integer type #
# MyISAM branch #
# #
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: Elena Stepanova #
# Change Date: 2017-02-18 #
# Change: The test file is spawned from the mega-test partition_int_myisam #
################################################################################
#
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# Please read the README at the end of inc/partition.pre before changing
# any of the variables.
#
--source include/long_test.inc
#------------------------------------------------------------------------------#
# General not engine specific settings and requirements
##### Options, for debugging support #####
let $debug= 0;
# The server must support partitioning.
--source include/have_partition.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
##### Storage engine to be tested
let $engine= 'MYISAM';
##### number of rows to be inserted
let $maxrows=65535;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_bigint.inc

View File

@ -0,0 +1,46 @@
################################################################################
# t/partition_double_innodb.test #
# #
# Purpose: #
# Tests around float type #
# INNODB branch #
# #
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: Elena Stepanova #
# Change Date: 2017-02-18 #
# Change: The test file is spawned from the mega-test partition_float_innodb #
################################################################################
#
# NOTE: PLEASE DO NOT ADD NOT INNODB SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# Please read the README at the end of inc/partition.pre before changing
# any of the variables.
#
#------------------------------------------------------------------------------#
# General not engine specific settings and requirements
##### Options, for debugging support #####
let $debug= 0;
# The server must support partitioning.
--source include/have_partition.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
##### Storage engine to be tested
--source include/have_innodb.inc
let $engine= 'InnoDB';
##### Number of row to be inserted.
let $maxrows=1024;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_double.inc

View File

@ -0,0 +1,46 @@
################################################################################
# t/partition_double_myisam.test #
# #
# Purpose: #
# Tests around float type #
# MyISAM branch #
# #
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: Elena Stepanova #
# Change Date: 2017-02-18 #
# Change: The test file is spawned from the mega-test partition_float_myisam #
################################################################################
#
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# Please read the README at the end of inc/partition.pre before changing
# any of the variables.
#
--source include/long_test.inc
#------------------------------------------------------------------------------#
# General not engine specific settings and requirements
##### Options, for debugging support #####
let $debug= 0;
# The server must support partitioning.
--source include/have_partition.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
##### Storage engine to be tested
let $engine= 'MYISAM';
##### Number of row to be inserted.
let $maxrows=16384;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_double.inc

View File

@ -8,9 +8,9 @@
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: #
# Change Date: #
# Change: #
# Change Author: Elena Stepanova #
# Change Date: 2017-02-18 #
# Change: The test for double type has been spawned into a separate test file #
################################################################################
#
@ -44,4 +44,3 @@ let $maxrows=1024;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_float.inc
--source suite/parts/inc/partition_double.inc

View File

@ -8,9 +8,9 @@
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: #
# Change Date: #
# Change: #
# Change Author: Elena Stepanova #
# Change Date: 2017-02-18 #
# Change: The test for double type has been spawned into a separate test file #
################################################################################
#
@ -44,4 +44,3 @@ let $maxrows=16384;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_float.inc
--source suite/parts/inc/partition_double.inc

View File

@ -8,9 +8,9 @@
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: #
# Change Date: #
# Change: #
# Change Author: Elena Stepanova #
# Change Date: 2017-02-18 #
# Change: Int subtypes (tinyint etc.) have been spawned into separate tests #
################################################################################
#
@ -43,8 +43,4 @@ let $maxrows=1024;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_tinyint.inc
--source suite/parts/inc/partition_smallint.inc
--source suite/parts/inc/partition_int.inc
--source suite/parts/inc/partition_mediumint.inc
--source suite/parts/inc/partition_bigint.inc

View File

@ -8,9 +8,9 @@
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: #
# Change Date: #
# Change: #
# Change Author: Elena Stepanova #
# Change Date: 2017-02-18 #
# Change: Int subtypes (tinyint etc.) have been spawned into separate tests #
################################################################################
#
@ -43,8 +43,4 @@ let $maxrows=65535;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_tinyint.inc
--source suite/parts/inc/partition_smallint.inc
--source suite/parts/inc/partition_int.inc
--source suite/parts/inc/partition_mediumint.inc
--source suite/parts/inc/partition_bigint.inc

View File

@ -0,0 +1,46 @@
################################################################################
# t/partition_mediumint_innodb.test #
# #
# Purpose: #
# Tests around integer type #
# INNODB branch #
# #
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: Elena Stepanova #
# Change Date: 2017-02-18 #
# Change: The test file is spawned from the mega-test partition_int_innodb #
################################################################################
#
# NOTE: PLEASE DO NOT ADD NOT INNODB SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# Please read the README at the end of inc/partition.pre before changing
# any of the variables.
#
#------------------------------------------------------------------------------#
# General not engine specific settings and requirements
##### Options, for debugging support #####
let $debug= 0;
# The server must support partitioning.
--source include/have_partition.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
##### Storage engine to be tested
--source include/have_innodb.inc
let $engine= 'InnoDB';
##### max rows to be inserted
let $maxrows=1024;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_mediumint.inc

View File

@ -0,0 +1,46 @@
################################################################################
# t/partition_mediumint_myisam.test #
# #
# Purpose: #
# Tests around integer type #
# MyISAM branch #
# #
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: Elena Stepanova #
# Change Date: 2017-02-18 #
# Change: The test file is spawned from the mega-test partition_int_myisam #
################################################################################
#
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# Please read the README at the end of inc/partition.pre before changing
# any of the variables.
#
--source include/long_test.inc
#------------------------------------------------------------------------------#
# General not engine specific settings and requirements
##### Options, for debugging support #####
let $debug= 0;
# The server must support partitioning.
--source include/have_partition.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
##### Storage engine to be tested
let $engine= 'MYISAM';
##### number of rows to be inserted
let $maxrows=65535;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_mediumint.inc

View File

@ -0,0 +1,46 @@
################################################################################
# t/partition_smallint_innodb.test #
# #
# Purpose: #
# Tests around integer type #
# INNODB branch #
# #
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: Elena Stepanova #
# Change Date: 2017-02-18 #
# Change: The test file is spawned from the mega-test partition_int_innodb #
################################################################################
#
# NOTE: PLEASE DO NOT ADD NOT INNODB SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# Please read the README at the end of inc/partition.pre before changing
# any of the variables.
#
#------------------------------------------------------------------------------#
# General not engine specific settings and requirements
##### Options, for debugging support #####
let $debug= 0;
# The server must support partitioning.
--source include/have_partition.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
##### Storage engine to be tested
--source include/have_innodb.inc
let $engine= 'InnoDB';
##### max rows to be inserted
let $maxrows=1024;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_smallint.inc

View File

@ -0,0 +1,46 @@
################################################################################
# t/partition_smallint_myisam.test #
# #
# Purpose: #
# Tests around integer type #
# MyISAM branch #
# #
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: Elena Stepanova #
# Change Date: 2017-02-18 #
# Change: The test file is spawned from the mega-test partition_int_myisam #
################################################################################
#
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# Please read the README at the end of inc/partition.pre before changing
# any of the variables.
#
--source include/long_test.inc
#------------------------------------------------------------------------------#
# General not engine specific settings and requirements
##### Options, for debugging support #####
let $debug= 0;
# The server must support partitioning.
--source include/have_partition.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
##### Storage engine to be tested
let $engine= 'MYISAM';
##### number of rows to be inserted
let $maxrows=65535;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_smallint.inc

View File

@ -0,0 +1,46 @@
################################################################################
# t/partition_tinyint_innodb.test #
# #
# Purpose: #
# Tests around integer type #
# INNODB branch #
# #
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: Elena Stepanova #
# Change Date: 2017-02-18 #
# Change: The test file is spawned from the mega-test partition_int_innodb #
################################################################################
#
# NOTE: PLEASE DO NOT ADD NOT INNODB SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# Please read the README at the end of inc/partition.pre before changing
# any of the variables.
#
#------------------------------------------------------------------------------#
# General not engine specific settings and requirements
##### Options, for debugging support #####
let $debug= 0;
# The server must support partitioning.
--source include/have_partition.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
##### Storage engine to be tested
--source include/have_innodb.inc
let $engine= 'InnoDB';
##### max rows to be inserted
let $maxrows=1024;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_tinyint.inc

View File

@ -0,0 +1,46 @@
################################################################################
# t/partition_tinyint_myisam.test #
# #
# Purpose: #
# Tests around integer type #
# MyISAM branch #
# #
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: Elena Stepanova #
# Change Date: 2017-02-18 #
# Change: The test file is spawned from the mega-test partition_int_myisam #
################################################################################
#
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# Please read the README at the end of inc/partition.pre before changing
# any of the variables.
#
--source include/long_test.inc
#------------------------------------------------------------------------------#
# General not engine specific settings and requirements
##### Options, for debugging support #####
let $debug= 0;
# The server must support partitioning.
--source include/have_partition.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
##### Storage engine to be tested
let $engine= 'MYISAM';
##### number of rows to be inserted
let $maxrows=65535;
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_tinyint.inc

View File

@ -7,7 +7,6 @@ RESET SLAVE;
SET @restore_slave_net_timeout=@@global.slave_net_timeout;
RESET MASTER;
SET @restore_slave_net_timeout=@@global.slave_net_timeout;
SET @restore_event_scheduler=@@global.event_scheduler;
*** Default value ***
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root';
@ -221,7 +220,7 @@ RESET SLAVE;
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=5;
include/start_slave.inc
SET @@global.event_scheduler=1;
Number of received heartbeat events: 0
Received heartbeats meet expectations: TRUE
DELETE FROM t1;
DROP EVENT e1;

View File

@ -34,7 +34,6 @@ eval SET @restore_slave_heartbeat_timeout=$slave_heartbeat_timeout;
--connection master
RESET MASTER;
SET @restore_slave_net_timeout=@@global.slave_net_timeout;
SET @restore_event_scheduler=@@global.event_scheduler;
--echo
#
@ -352,21 +351,54 @@ eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTE
--connection master
# Enable scheduler
SET @@global.event_scheduler=1;
--sync_slave_with_master
let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
# Wait some updates for table t1 from master
let $wait_condition= SELECT COUNT(*)=1 FROM t1 WHERE a > 5;
--connection master
# Whether or not to send a heartbeat is decided on the master, based on
# whether the binlog was updated during the period or not.
# Even with the 1-second event, we cannot make the master to write binary
# logs (or execute SQL) in a timely manner. We can only check that they
# were executed in a timely manner, and if they were not, neutralize the
# heartbeat check on the slave.
# We will wait for 5 events, and keep checking 'Binlog_commits' on master.
# Time interval between consequent events will be measured.
# We can only expect that no heartbeats have been sent if the interval
# between events never exceeded MASTER_HEARTBEAT_PERIOD.
# If it has exceeded the value at least once, the slave can legitimately
# receive a heartbeat (but we cannot require it, because the delay
# could have occurred somewhere else, e.g. upon checking the status).
# So, if the delay is detected, we will signal slave to ignore possible
# heartbeats.
let $possible_heartbeats= 0;
let $commits_to_wait= 5;
while ($commits_to_wait)
{
let $tm= `SELECT UNIX_TIMESTAMP(NOW(3))`;
let $binlog_commits= query_get_value(SHOW STATUS LIKE 'Binlog_commits', Value, 1);
let $wait_condition= SELECT VARIABLE_VALUE > $binlog_commits FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME= 'BINLOG_COMMITS';
--source include/wait_condition.inc
dec $commits_to_wait;
if (`SELECT UNIX_TIMESTAMP(NOW(3)) > $tm + 5`)
{
let $possible_heartbeats= 1;
let $commits_to_wait= 0;
}
}
--connection slave
let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) > 0 AS Result, Result, 1);
--echo Number of received heartbeat events: $result
let $result= `SELECT CASE WHEN $possible_heartbeats THEN 'TRUE' WHEN $rcvd_heartbeats_after - $rcvd_heartbeats_before > 0 THEN 'FALSE' ELSE 'TRUE' END`;
--echo Received heartbeats meet expectations: $result
--connection master
DELETE FROM t1;
DROP EVENT e1;
--sync_slave_with_master
--echo
# Check received heartbeat events while logs flushed on slave
--echo *** Flush logs on slave ***
STOP SLAVE;

View File

@ -0,0 +1,25 @@
SELECT @@innodb_stats_include_delete_marked;
@@innodb_stats_include_delete_marked
0
SET GLOBAL innodb_stats_include_delete_marked=1;
SELECT @@innodb_stats_include_delete_marked;
@@innodb_stats_include_delete_marked
1
SET SESSION innodb_stats_include_delete_marked=1;
ERROR HY000: Variable 'innodb_stats_include_delete_marked' is a GLOBAL variable and should be set with SET GLOBAL
SET GLOBAL innodb_stats_include_delete_marked=100;
ERROR 42000: Variable 'innodb_stats_include_delete_marked' can't be set to the value of '100'
SET GLOBAL innodb_stats_include_delete_marked=foo;
ERROR 42000: Variable 'innodb_stats_include_delete_marked' can't be set to the value of 'foo'
SET GLOBAL innodb_stats_include_delete_marked=OFF ;
SELECT @@innodb_stats_include_delete_marked;
@@innodb_stats_include_delete_marked
0
SET GLOBAL innodb_stats_include_delete_marked=ON ;
SELECT @@innodb_stats_include_delete_marked;
@@innodb_stats_include_delete_marked
1
SET GLOBAL innodb_stats_include_delete_marked=Default ;
SELECT @@innodb_stats_include_delete_marked;
@@innodb_stats_include_delete_marked
0

View File

@ -0,0 +1,53 @@
###############################################################################
# #
# Variable Name: innodb_stats_include_delete_marked #
# Scope: Global #
# Access Type: Dynamic #
# Data Type: numeric #
# #
# #
# Creation Date: 2016-08-29 #
# Author : Aditya #
# #
# #
# Description: #
# * Value check #
# * Scope check #
# #
###############################################################################
--source include/have_innodb.inc
####################################################################
# Display default value #
####################################################################
SELECT @@innodb_stats_include_delete_marked;
SET GLOBAL innodb_stats_include_delete_marked=1;
SELECT @@innodb_stats_include_delete_marked;
# check error
--error ER_GLOBAL_VARIABLE
SET SESSION innodb_stats_include_delete_marked=1;
# check error
--error ER_WRONG_VALUE_FOR_VAR
SET GLOBAL innodb_stats_include_delete_marked=100;
# check error
--error ER_WRONG_VALUE_FOR_VAR
SET GLOBAL innodb_stats_include_delete_marked=foo;
SET GLOBAL innodb_stats_include_delete_marked=OFF ;
SELECT @@innodb_stats_include_delete_marked;
SET GLOBAL innodb_stats_include_delete_marked=ON ;
SELECT @@innodb_stats_include_delete_marked;
# Check with default setting
SET GLOBAL innodb_stats_include_delete_marked=Default ;
SELECT @@innodb_stats_include_delete_marked;

View File

@ -21,6 +21,9 @@ SHOW VARIABLES LIKE 'secure_file_priv';
--perl
use File::Basename;
my $protected_file= dirname($ENV{MYSQLTEST_VARDIR}).'/bug50373.txt';
# Ensure bug50373.txt does not exist (e.g. leftover from previous
# test runs).
unlink $protected_file;
open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/bug50373.inc") or die;
print FILE "SELECT * FROM t1 INTO OUTFILE '".$protected_file."';\n";
print FILE "DELETE FROM t1;\n";

View File

@ -295,3 +295,112 @@ Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a` from `test`.`t1`
SELECT * FROM t1 NATURAL JOIN t2;
b a
DROP TABLE t1,t2;
create table t1 (
pk integer auto_increment,
bi integer not null,
vi integer generated always as (bi) persistent,
bc varchar(1) not null,
vc varchar(2) generated always as (concat(bc, bc)) persistent,
primary key (pk),
key (vi, vc));
insert t1 (bi, bc) values (0, 'x'), (0, 'n'), (1, 'w'), (7, 's'), (0, 'a'), (4, 'd'), (1, 'w'), (1, 'j'), (1, 'm'), (4, 'k'), (7, 't'), (4, 'k'), (2, 'e'), (0, 'i'), (1, 't'), (6, 'z'), (3, 'c'), (6, 'i'), (8, 'v');
create table t2 (
pk integer auto_increment,
bi integer not null,
vi integer generated always as (bi) persistent,
bc varchar(257) not null,
vc varchar(2) generated always as (concat(bc, bc)) persistent,
primary key (pk),
key (vi, vc));
insert t2 (bi, bc) values (1, 'c'), (8, 'm'), (9, 'd'), (6, 'y'), (1, 't'), (6, 'd'), (2, 's'), (4, 'r'), (8, 'm'), (4, 'b'), (4, 'x'), (7, 'g'), (4, 'p'), (1, 'q'), (9, 'w'), (4, 'd'), (8, 'e'), (4, 'b'), (8, 'y');
explain # should be using join buffer
select t2.vi from (t2 as t3 right join (t2 left join t1 on (t1.bi = t2.vi)) on (t1.vc = t2.vc));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL vi 10 NULL 19 Using index
1 SIMPLE t1 ALL NULL NULL NULL NULL 19 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t3 index NULL PRIMARY 4 NULL 19 Using where; Using index; Using join buffer (incremental, BNL join)
select t2.vi from (t2 as t3 right join (t2 left join t1 on (t1.bi = t2.vi)) on (t1.vc = t2.vc));
vi
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
6
6
6
6
7
7
8
8
8
8
9
9
drop table t2,t1;

View File

@ -68,3 +68,35 @@ SELECT * FROM t1 NATURAL JOIN t2;
SELECT * FROM t1 NATURAL JOIN t2;
DROP TABLE t1,t2;
#
# MDEV-11525 Assertion `cp + len <= buff + buff_size' failed in JOIN_CACHE::write_record_data
#
create table t1 (
pk integer auto_increment,
bi integer not null,
vi integer generated always as (bi) persistent,
bc varchar(1) not null,
vc varchar(2) generated always as (concat(bc, bc)) persistent,
primary key (pk),
key (vi, vc));
insert t1 (bi, bc) values (0, 'x'), (0, 'n'), (1, 'w'), (7, 's'), (0, 'a'), (4, 'd'), (1, 'w'), (1, 'j'), (1, 'm'), (4, 'k'), (7, 't'), (4, 'k'), (2, 'e'), (0, 'i'), (1, 't'), (6, 'z'), (3, 'c'), (6, 'i'), (8, 'v');
create table t2 (
pk integer auto_increment,
bi integer not null,
vi integer generated always as (bi) persistent,
bc varchar(257) not null,
vc varchar(2) generated always as (concat(bc, bc)) persistent,
primary key (pk),
key (vi, vc));
insert t2 (bi, bc) values (1, 'c'), (8, 'm'), (9, 'd'), (6, 'y'), (1, 't'), (6, 'd'), (2, 's'), (4, 'r'), (8, 'm'), (4, 'b'), (4, 'x'), (7, 'g'), (4, 'p'), (1, 'q'), (9, 'w'), (4, 'd'), (8, 'e'), (4, 'b'), (8, 'y');
explain # should be using join buffer
select t2.vi from (t2 as t3 right join (t2 left join t1 on (t1.bi = t2.vi)) on (t1.vc = t2.vc));
--sorted_result
select t2.vi from (t2 as t3 right join (t2 left join t1 on (t1.bi = t2.vi)) on (t1.vc = t2.vc));
drop table t2,t1;
#
# End of 5.5 tests
#

View File

@ -875,4 +875,27 @@ SELECT Customer, Success, SUM(OrderSize)
DROP TABLE example1463;
set sql_mode= @save_sql_mode;
--echo #
--echo # MDEV-9028: SELECT DISTINCT constant column of derived table
--echo # used as the second operand of LEFT JOIN
--echo #
create table t1 (id int, data varchar(255));
insert into t1 values (1,'yes'),(2,'yes');
select distinct t1.id, tt.id, tt.data
from t1
left join
(select t1.id, 'yes' as data from t1) as tt
on t1.id = tt.id;
select distinct t1.id, tt.id, tt.data
from t1
left join
(select t1.id, 'yes' as data from t1 where id > 1) as tt
on t1.id = tt.id;
drop table t1;
--echo # end of 5.5

View File

@ -2176,6 +2176,68 @@ DROP USER mysqltest_u1@localhost;
--echo # End of Bug#38347.
--echo
--echo #
--echo # BUG#11759114 - '51401: GRANT TREATS NONEXISTENT FUNCTIONS/PRIVILEGES
--echo # DIFFERENTLY'.
--echo #
--disable_warnings
drop database if exists mysqltest_db1;
--enable_warnings
create database mysqltest_db1;
create user mysqltest_u1;
--echo # Both GRANT statements below should fail with the same error.
--error ER_SP_DOES_NOT_EXIST
grant execute on function mysqltest_db1.f1 to mysqltest_u1;
--error ER_SP_DOES_NOT_EXIST
grant execute on procedure mysqltest_db1.p1 to mysqltest_u1;
--echo # Let us show that GRANT behaviour for routines is consistent
--echo # with GRANT behaviour for tables. Attempt to grant privilege
--echo # on non-existent table also results in an error.
--error ER_NO_SUCH_TABLE
grant select on mysqltest_db1.t1 to mysqltest_u1;
show grants for mysqltest_u1;
drop database mysqltest_db1;
drop user mysqltest_u1;
--echo #
--echo # Bug#12766319 - 61865: RENAME USER DOES NOT WORK CORRECTLY -
--echo # REQUIRES FLUSH PRIVILEGES
--echo #
CREATE USER foo@'127.0.0.1';
GRANT ALL ON *.* TO foo@'127.0.0.1';
--echo # First attempt, should connect successfully
connect (conn1, '127.0.0.1', foo,,test);
SELECT user(), current_user();
--echo # Rename the user
RENAME USER foo@'127.0.0.1' to foo@'127.0.0.0/255.0.0.0';
--echo # Second attempt, should connect successfully as its valid mask
--echo # This was failing without fix
connect (conn2, '127.0.0.1', foo,,test);
SELECT user(), current_user();
--echo # Rename the user back to original
RENAME USER foo@'127.0.0.0/255.0.0.0' to foo@'127.0.0.1';
--echo # Third attempt, should connect successfully
connect (conn3, '127.0.0.1', foo,,test);
SELECT user(), current_user();
--echo # Clean-up
connection default;
disconnect conn1;
disconnect conn2;
disconnect conn3;
DROP USER foo@'127.0.0.1';
--echo # End of Bug#12766319
--echo #
--echo # Bug#11756966 - 48958: STORED PROCEDURES CAN BE LEVERAGED TO BYPASS
--echo # DATABASE SECURITY
@ -2210,26 +2272,3 @@ DROP DATABASE secret;
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
--echo #
--echo # BUG#11759114 - '51401: GRANT TREATS NONEXISTENT FUNCTIONS/PRIVILEGES
--echo # DIFFERENTLY'.
--echo #
--disable_warnings
drop database if exists mysqltest_db1;
--enable_warnings
create database mysqltest_db1;
create user mysqltest_u1;
--echo # Both GRANT statements below should fail with the same error.
--error ER_SP_DOES_NOT_EXIST
grant execute on function mysqltest_db1.f1 to mysqltest_u1;
--error ER_SP_DOES_NOT_EXIST
grant execute on procedure mysqltest_db1.p1 to mysqltest_u1;
--echo # Let us show that GRANT behaviour for routines is consistent
--echo # with GRANT behaviour for tables. Attempt to grant privilege
--echo # on non-existent table also results in an error.
--error ER_NO_SUCH_TABLE
grant select on mysqltest_db1.t1 to mysqltest_u1;
show grants for mysqltest_u1;
drop database mysqltest_db1;
drop user mysqltest_u1;

View File

@ -1309,5 +1309,74 @@ LEFT JOIN t4 AS alias5
JOIN t5 ON alias5.f5
ON alias2.f3 ON alias1.f2;
DROP TABLE t1,t2,t3,t4,t5;
set optimizer_search_depth= @tmp_mdev621;
--echo #
--echo # MDEV-7992: Nested left joins + 'not exists' optimization
--echo #
CREATE TABLE t1(
K1 INT PRIMARY KEY,
Name VARCHAR(15)
);
INSERT INTO t1 VALUES
(1,'T1Row1'), (2,'T1Row2');
CREATE TABLE t2(
K2 INT PRIMARY KEY,
K1r INT,
rowTimestamp DATETIME,
Event VARCHAR(15)
);
INSERT INTO t2 VALUES
(1, 1, '2015-04-13 10:42:11' ,'T1Row1Event1'),
(2, 1, '2015-04-13 10:42:12' ,'T1Row1Event2'),
(3, 1, '2015-04-13 10:42:12' ,'T1Row1Event3');
let $q1=
SELECT t1a.*, t2a.*,
t2i.K2 AS K2B, t2i.K1r AS K1rB,
t2i.rowTimestamp AS rowTimestampB, t2i.Event AS EventB
FROM
t1 t1a JOIN t2 t2a ON t2a.K1r = t1a.K1
LEFT JOIN
( t1 t1i LEFT JOIN t2 t2i ON t2i.K1r = t1i.K1)
ON (t1i.K1 = 1) AND
(((t2i.K1r = t1a.K1 AND t2i.rowTimestamp > t2a.rowTimestamp ) OR
(t2i.rowTimestamp = t2a.rowTimestamp AND t2i.K2 > t2a.K2))
OR (t2i.K2 IS NULL))
WHERE
t2a.K1r = 1 AND t2i.K2 IS NULL;
eval $q1;
eval EXPLAIN EXTENDED $q1;
CREATE VIEW v1 AS
SELECT t2i.*
FROM t1 as t1i LEFT JOIN t2 as t2i ON t2i.K1r = t1i.K1
WHERE t1i.K1 = 1 ;
let $q2=
SELECT
t1a.*, t2a.*, t2b.K2 as K2B, t2b.K1r as K1rB,
t2b.rowTimestamp as rowTimestampB, t2b.Event as EventB
FROM
t1 as t1a JOIN t2 as t2a ON t2a.K1r = t1a.K1
LEFT JOIN
v1 as t2b
ON ((t2b.K1r = t1a.K1 AND t2b.rowTimestamp > t2a.rowTimestamp) OR
(t2b.rowTimestamp = t2a.rowTimestamp AND t2b.K2 > t2a.K2))
OR (t2b.K2 IS NULL)
WHERE
t1a.K1 = 1 AND
t2b.K2 IS NULL;
eval $q2;
eval EXPLAIN EXTENDED $q2;
DROP VIEW v1;
DROP TABLE t1,t2;
set optimizer_search_depth= @tmp_mdev621;

View File

@ -2512,3 +2512,11 @@ if (`select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Wind
}
--exec $MYSQL_DUMP --routines --compact $shell_ready_db_name
DROP DATABASE `a\"'``b`;
#"
# MDEV-11505 wrong databasename in mysqldump comment
#
let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/bug11505.sql;
let SEARCH_PATTERN=Database: mysql;
exec $MYSQL_DUMP mysql func > $SEARCH_FILE;
source include/search_pattern_in_file.inc;

View File

@ -820,6 +820,104 @@ INSERT INTO t1 (d) VALUES ('1991-01-01');
SELECT * FROM t1 WHERE d = '1991-01-01';
DROP TABLE t1;
set global default_storage_engine=default;
--echo #
--echo # MDEV-9455: [ERROR] mysqld got signal 11
--echo #
CREATE TABLE `t1` (
`DIARY_TOTAL_DAY_SEQ` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`IMORY_ID` bigint(20) NOT NULL,
`NAME` varchar(75) DEFAULT NULL,
`DATETIME` varchar(10) NOT NULL DEFAULT '',
`DAILY_CALL_CNT` int(11) DEFAULT NULL,
`DAILY_SMS_CNT` int(11) DEFAULT NULL,
`NUMBER` varchar(64) DEFAULT NULL,
`DURATION` varchar(16) DEFAULT NULL,
PRIMARY KEY (`DIARY_TOTAL_DAY_SEQ`,`DATETIME`),
KEY `IDX_t1_01` (`IMORY_ID`,`DATETIME`)
) AUTO_INCREMENT=328702514 DEFAULT CHARSET=utf8mb4
PARTITION BY RANGE COLUMNS(`DATETIME`)
(PARTITION p0 VALUES LESS THAN ('2015-10-01') ENGINE = InnoDB,
PARTITION p1 VALUES LESS THAN ('2015-11-01') ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN ('2015-12-01') ENGINE = InnoDB,
PARTITION p3 VALUES LESS THAN ('2016-01-01') ENGINE = InnoDB,
PARTITION p4 VALUES LESS THAN ('2016-02-01') ENGINE = InnoDB,
PARTITION p5 VALUES LESS THAN ('2016-03-01') ENGINE = InnoDB,
PARTITION p6 VALUES LESS THAN ('2016-04-01') ENGINE = InnoDB,
PARTITION p7 VALUES LESS THAN ('2016-05-01') ENGINE = InnoDB,
PARTITION p8 VALUES LESS THAN ('2016-06-01') ENGINE = InnoDB,
PARTITION p9 VALUES LESS THAN ('2016-07-01') ENGINE = InnoDB,
PARTITION p10 VALUES LESS THAN ('2016-08-01') ENGINE = InnoDB)
;
CREATE TABLE `t2` (
`DIARY_SEQ` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`IMORY_ID` bigint(20) NOT NULL,
`CALL_TYPE` varchar(1) DEFAULT NULL,
`DATA_TYPE` varchar(1) DEFAULT NULL,
`FEATURES` varchar(1) DEFAULT NULL,
`NAME` varchar(75) DEFAULT NULL,
`NUMBER` varchar(64) DEFAULT NULL,
`DATETIME` datetime NOT NULL,
`REG_DATE` datetime NOT NULL,
`TITLE` varchar(50) DEFAULT NULL,
`BODY` varchar(4200) DEFAULT NULL,
`MIME_TYPE` varchar(32) DEFAULT NULL,
`DURATION` varchar(16) DEFAULT NULL,
`DEVICE_ID` varchar(64) DEFAULT NULL,
`DEVICE_NAME` varchar(32) DEFAULT NULL,
PRIMARY KEY (`DIARY_SEQ`,`DATETIME`,`REG_DATE`),
KEY `IDX_TB_DIARY_01` (`IMORY_ID`,`DATETIME`,`CALL_TYPE`,`NUMBER`),
KEY `IDX_TB_DIARY_02` (`REG_DATE`)
) AUTO_INCREMENT=688799006 DEFAULT CHARSET=utf8mb4
PARTITION BY RANGE COLUMNS(REG_DATE)
(PARTITION p0 VALUES LESS THAN ('2015-10-01') ENGINE = InnoDB,
PARTITION p1 VALUES LESS THAN ('2015-11-01') ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN ('2015-12-01') ENGINE = InnoDB,
PARTITION p3 VALUES LESS THAN ('2016-01-01') ENGINE = InnoDB,
PARTITION p4 VALUES LESS THAN ('2016-02-01') ENGINE = InnoDB,
PARTITION p5 VALUES LESS THAN ('2016-03-01') ENGINE = InnoDB,
PARTITION p6 VALUES LESS THAN ('2016-04-01') ENGINE = InnoDB,
PARTITION p7 VALUES LESS THAN ('2016-05-01') ENGINE = InnoDB,
PARTITION p8 VALUES LESS THAN ('2016-06-01') ENGINE = InnoDB,
PARTITION p9 VALUES LESS THAN ('2016-07-01') ENGINE = InnoDB,
PARTITION p10 VALUES LESS THAN ('2016-08-01') ENGINE = InnoDB)
;
SELECT
A.IMORY_ID,
A.NUMBER,
A.NAME,
DATE_FORMAT(A.DATETIME, '%Y-%m-%d') AS TARGET_DATE,
SUM( CASE WHEN A.DATA_TYPE='1' THEN 1 ELSE 0 END) AS CALL_CNT,
SUM( CASE WHEN A.DATA_TYPE IN ('2', '3') THEN 1 ELSE 0 END) AS SMS_CNT,
SUM(CAST(A.DURATION AS INT)) AS DURATION,
( SELECT COUNT(*)
FROM t1
WHERE IMORY_ID=A.IMORY_ID
AND NUMBER=A.NUMBER
AND NAME=A.NAME
AND DATETIME = DATE_FORMAT(A.DATETIME, '%Y-%m-%d')
) STATS_COUNT
FROM t2 A
WHERE A.IMORY_ID = 55094102
AND A.DATETIME LIKE (
SELECT CONCAT (DATE_FORMAT(DATETIME, '%Y-%m-%d') ,'%')
FROM t2
WHERE IMORY_ID=55094102
AND DIARY_SEQ IN ( 608351221, 608351225, 608351229 )
group by DATE_FORMAT(DATETIME, '%Y-%m-%d')
)
GROUP BY A.IMORY_ID, A.NUMBER, A.NAME, DATE_FORMAT(A.DATETIME, '%Y-%m-%d')
;
drop table t2, t1;
set global default_storage_engine='innodb';
--echo #
--echo # MDEV-5963: InnoDB: Assertion failure in file row0sel.cc line 2503,
--echo # Failing assertion: 0 with "key ptr now exceeds key end by 762 bytes"

View File

@ -216,6 +216,28 @@ PARTITION BY RANGE (a)
PARTITION pMax VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Partition p1, first row");
DROP TABLE t1;
--echo #
--echo # MDEV-10418 Assertion `m_extra_cache' failed
--echo # in ha_partition::late_extra_cache(uint)
--echo #
CREATE TABLE t1 (f1 INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (f2 INT) ENGINE=MyISAM PARTITION BY RANGE(f2) (PARTITION pmax VALUES LESS THAN MAXVALUE);
INSERT INTO t2 VALUES (8);
CREATE ALGORITHM = MERGE VIEW v AS SELECT f2 FROM t2, t1;
UPDATE v SET f2 = 1;
SELECT * FROM t2;
DROP VIEW v;
DROP TABLE t2;
DROP TABLE t1;
--echo #
--echo # bug#11760213-52599: ALTER TABLE REMOVE PARTITIONING ON NON-PARTITIONED
--echo # TABLE CORRUPTS MYISAM

View File

@ -3680,5 +3680,38 @@ EXECUTE stmt;
deallocate prepare stmt;
drop table t1,t2,t3,t4;
--echo #
--echo # MDEV-11859: the plans for the first and the second executions
--echo # of PS are not the same
--echo #
create table t1 (id int, c varchar(3), key idx(c))engine=myisam;
insert into t1 values (3,'bar'), (1,'xxx'), (2,'foo'), (5,'yyy');
prepare stmt1 from
"explain extended
select * from t1 where (1, 2) in ( select 3, 4 ) or c = 'foo'";
execute stmt1;
execute stmt1;
deallocate prepare stmt1;
prepare stmt1 from
"select * from t1 where (1, 2) in ( select 3, 4 ) or c = 'foo'";
flush status;
execute stmt1;
show status like '%Handler_read%';
flush status;
execute stmt1;
show status like '%Handler_read%';
deallocate prepare stmt1;
prepare stmt2 from
"explain extended
select * from t1 where (1, 2) in ( select 3, 4 )";
execute stmt2;
execute stmt2;
deallocate prepare stmt2;
drop table t1;
--echo # End of 5.5 tests

View File

@ -57,9 +57,9 @@ SELECT * FROM City
EXPLAIN
SELECT * FROM City
WHERE Population > 100000 AND Name LIKE 'Aba%' OR
Country IN ('CAN', 'ARG') AND ID < 3800 OR
Country < 'U' AND Name LIKE 'Zhu%' OR
ID BETWEEN 3800 AND 3810;
Country IN ('CAN', 'ARG') AND ID BETWEEN 120 AND 130 OR
Country <= 'ALB' AND Name LIKE 'L%' OR
ID BETWEEN 3807 AND 3810;
# The output of the next 3 commands tells us about selectivities
# of the conditions utilized in 2 queries following after them
@ -1206,6 +1206,41 @@ SELECT * FROM t1
DROP TABLE t1;
--echo #
--echo # MDEV-8603: Wrong result OR/AND condition over index fields
--echo #
CREATE TABLE t1 (
id INT NOT NULL,
state VARCHAR(64),
capital VARCHAR(64),
UNIQUE KEY (id),
KEY state (state,id),
KEY capital (capital, id)
);
INSERT INTO t1 VALUES
(1,'Arizona','Phoenix'),
(2,'Hawaii','Honolulu'),
(3,'Georgia','Atlanta'),
(4,'Florida','Tallahassee'),
(5,'Alaska','Juneau'),
(6,'Michigan','Lansing'),
(7,'Pennsylvania','Harrisburg'),
(8,'Virginia','Richmond')
;
EXPLAIN
SELECT * FROM t1 FORCE KEY (state,capital)
WHERE ( state = 'Alabama' OR state >= 'Colorado' ) AND id != 9
OR ( capital >= 'Topeka' OR state = 'Kansas' ) AND state != 'Texas';
SELECT * FROM t1 FORCE KEY (state,capital)
WHERE ( state = 'Alabama' OR state >= 'Colorado' ) AND id != 9
OR ( capital >= 'Topeka' OR state = 'Kansas' ) AND state != 'Texas';
DROP TABLE t1;
#the following command must be the last one in the file
set session optimizer_switch='index_merge_sort_intersection=default';

View File

@ -9,7 +9,7 @@
eval create table t1 (a int) engine=myisam data directory='$MYSQL_TMP_DIR';
insert t1 values (1);
--system ln -s $MYSQL_TMP_DIR/foobar5543 $MYSQL_TMP_DIR/t1.TMD
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
--replace_regex / '.*\/t1/ 'MYSQL_TMP_DIR\/t1/
repair table t1;
drop table t1;
@ -17,7 +17,7 @@ drop table t1;
eval create table t2 (a int) engine=aria data directory='$MYSQL_TMP_DIR';
insert t2 values (1);
--system ln -s $MYSQL_TMP_DIR/foobar5543 $MYSQL_TMP_DIR/t2.TMD
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
--replace_regex / '.*\/t2/ 'MYSQL_TMP_DIR\/t2/
repair table t2;
drop table t2;

View File

@ -0,0 +1,6 @@
#
# MDEV-11902 mi_open race condition
#
source include/have_maria.inc;
set default_storage_engine=Aria;
source symlink-myisam-11902.test;

View File

@ -0,0 +1,60 @@
#
# MDEV-11902 mi_open race condition
#
source include/have_debug_sync.inc;
source include/have_symlink.inc;
source include/not_windows.inc;
call mtr.add_suppression("File.*t1.* not found");
create table mysql.t1 (a int, b char(16), index(a));
insert mysql.t1 values (100, 'test'),(101,'test');
let $datadir=`select @@datadir`;
exec mkdir $MYSQLTEST_VARDIR/tmp/foo;
replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR;
eval create table t1 (a int, b char(16), index(a))
data directory="$MYSQLTEST_VARDIR/tmp/foo";
insert t1 values (200, 'some'),(201,'some');
select * from t1;
flush tables;
set debug_sync='mi_open_datafile SIGNAL ok WAIT_FOR go';
send select * from t1;
connect con1, localhost, root;
set debug_sync='now WAIT_FOR ok';
exec rm -r $MYSQLTEST_VARDIR/tmp/foo;
exec ln -s $datadir/mysql $MYSQLTEST_VARDIR/tmp/foo;
set debug_sync='now SIGNAL go';
connection default;
replace_regex / '.*\/tmp\// 'MYSQLTEST_VARDIR\/tmp\// /31/20/;
error 29;
reap;
flush tables;
drop table if exists t1;
exec rm -r $MYSQLTEST_VARDIR/tmp/foo;
# same with INDEX DIRECTORY
exec mkdir $MYSQLTEST_VARDIR/tmp/foo;
replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR;
eval create table t1 (a int, b char(16), index (a))
index directory="$MYSQLTEST_VARDIR/tmp/foo";
insert t1 values (200, 'some'),(201,'some');
explain select a from t1;
select a from t1;
flush tables;
set debug_sync='mi_open_kfile SIGNAL waiting WAIT_FOR run';
send select a from t1;
connection con1;
set debug_sync='now WAIT_FOR waiting';
exec rm -r $MYSQLTEST_VARDIR/tmp/foo;
exec ln -s $datadir/mysql $MYSQLTEST_VARDIR/tmp/foo;
set debug_sync='now SIGNAL run';
connection default;
replace_regex / '.*\/test\// '.\/test\// /31/20/;
error ER_FILE_NOT_FOUND;
reap;
flush tables;
drop table if exists t1;
exec rm -r $MYSQLTEST_VARDIR/tmp/foo;
drop table mysql.t1;
set debug_sync='RESET';

View File

@ -535,11 +535,11 @@ CREATE TABLE t3 ( a varchar(1)) ;
INSERT IGNORE INTO t3 VALUES ('g');
CREATE TABLE t2 ( a int(11) NOT NULL, PRIMARY KEY (a));
INSERT INTO t2 VALUES (9), (10);
create view v1 as SELECT t1.* FROM t1 LEFT JOIN t2 ON ( t1.a = t2.a ) WHERE t2.a <> 0;
SELECT alias1.* FROM t3 LEFT JOIN v1 as alias1 ON ( t3.a = alias1.b );
EXPLAIN SELECT alias1.* FROM t3 LEFT JOIN v1 as alias1 ON ( t3.a = alias1.b );
drop view v1;
DROP TABLE t1,t2,t3;

View File

@ -5505,6 +5505,66 @@ SHOW CREATE VIEW v1;
drop view v1;
drop table t1,t2;
--echo #
--echo # MDEV-12099: usage of mergeable view with LEFT JOIN
--echo # that can be converted to INNER JOIN
--echo #
create table t1 (a int, b int, key(a)) engine=myisam;
insert into t1 values
(3,20), (7,10), (2,10), (4,30), (8,70),
(7,70), (9,100), (9,60), (8,80), (7,60);
create table t2 (c int, d int, key (c)) engine=myisam;
insert into t2 values
(50,100), (20, 200), (10,300),
(150,100), (120, 200), (110,300),
(250,100), (220, 200), (210,300);
create table t3(e int, f int not null, key(e), unique (f)) engine=myisam;
insert into t3 values
(100, 3), (300, 5), (400, 4), (300,7),
(300,2), (600, 13), (800, 15), (700, 14),
(600, 23), (800, 25), (700, 24);
create view v1 as
select * from t2 left join t3 on t3.e=t2.d where t3.f is not null;
select *
from t1 left join v1 on v1.c=t1.b
where t1.a < 5;
select *
from t1 left join ( t2 left join t3 on t3.e=t2.d )
on t2.c=t1.b and t3.f is not null
where t1.a < 5;
explain extended
select *
from t1 left join v1 on v1.c=t1.b
where t1.a < 5;
explain extended
select *
from t1 left join ( t2 left join t3 on t3.e=t2.d )
on t2.c=t1.b and t3.f is not null
where t1.a < 5;
explain extended
select *
from t1 left join v1 on v1.c=t1.b and v1.f=t1.a
where t1.a < 5;
explain extended
select *
from t1 left join ( t2 left join t3 on t3.e=t2.d )
on t2.c=t1.b and t3.f=t1.a and t3.f is not null
where t1.a < 5;
drop view v1;
drop table t1,t2,t3;
--echo # -----------------------------------------------------------------
--echo # -- End of 5.5 tests.
--echo # -----------------------------------------------------------------

View File

@ -23,78 +23,62 @@
#
##############################################################################
main.alter_table : Modified in 10.0.30
main.count_distinct2 : MDEV-11768 - timeout
main.create : Modified in 10.0.29
main.create_delayed : MDEV-10605 - failed with timeout
main.ctype_ucs2_def : Modified in 10.0.29
main.ctype_ucs2_query_cache : Modified in 10.0.29
main.ctype_utf16_def : Modified in 10.0.29
main.ctype_utf8 : Modified in 10.0.29
main.ctype_utf8mb4 : Modified in 10.0.29
main.ctype_utf8mb4 : Modified in 10.0.29 (load file changed)
main.debug_sync : MDEV-10607 - internal error
main.default : Modified in 10.0.29
main.derived : Modified in 10.0.29
main.derived : Modified in 10.0.30
main.derived_opt : MDEV-11768 - timeout
main.derived_view : Modified in 10.0.29
main.events_restart : MDEV-11221 - Assertion failure
main.events_slowlog : Added in 10.0.29
main.fulltext_charsets : Added in 10.0.29
main.func_time : Modified in 10.0.29
main.group_by : Modified in 10.0.29
main.group_by_innodb : Modified in 10.0.29
main.events_restart : MDEV-11221 - assertion failure
main.grant : Modified in 10.0.30
main.host_cache_size_functionality : MDEV-10606 - sporadic failure on shutdown
main.index_intersect_innodb : MDEV-10643 - failed with timeout
main.index_merge_innodb : MDEV-7142 - wrong result
main.information_schema_part : Modified in 10.0.29
main.innodb_mysql_lock : MDEV-7861 - sporadic lock detection failure
main.join_cache : Modified in 10.0.29
main.loaddata : Modified in 10.0.29
main.log_slow : Modified in 10.0.29
main.join_nested : Modified in 10.0.30
main.mdev-504 : MDEV-10607 - sporadic "can't connect"
main.mdev375 : MDEV-10607 - sporadic "can't connect"
main.merge : MDEV-10607 - sporadic "can't connect"
main.mysqldump : Modified in 10.0.30
main.mysqlhotcopy_myisam : MDEV-10995 - test hangs on debug build
main.mysqltest : MDEV-9269 - fails on Alpha
main.order_by : Modified in 10.0.29
main.parser : Modified in 10.0.29
main.pool_of_threads : Modified in 10.0.29
main.partition_innodb : Modified in 10.0.30
main.partition_myisam : Modified in 10.0.30
main.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count
main.selectivity : Modified in 10.0.29
main.range_vs_index_merge : Modified in 10.0.30
main.repair_symlink-5543 : Modified in 10.0.30
main.show_explain : MDEV-10674 - wrong result
main.signal_demo3 : MDEV-11720 - Thread stack overrun on Solaris
main.sp : Modified in 10.0.29
main.sp : Modified in 10.0.30
main.sp_notembedded : MDEV-10607 - internal error
main.sp-prelocking : Modified in 10.0.29
main.sp-security : MDEV-10607 - sporadic "can't connect"
main.stat_tables_par_innodb : MDEV-10515 - sporadic wrong results
main.subselect : Modified in 10.0.29
main.subselect2 : Modified in 10.0.29
main.subselect4 : Modified in 10.0.29
main.subselect_innodb : MDEV-10614 - sporadic wrong results
main.subselect_sj2_jcl6 : MDEV-11766 - unexpected warnings
main.type_bit_innodb : MDEV-11766 - unexpected warnings
main.type_decimal : Modified in 10.0.29
main.union : Modified in 10.0.29
main.view : Modified in 10.0.29
main.symlink-aria-11902 : Added in 10.0.30
main.symlink-myisam-11902 : Added in 10.0.30
main.table_elim : Modified in 10.0.30
main.view : Modified in 10.0.30
main.xa : MDEV-11769 - lock wait timeout
#----------------------------------------------------------------
archive.archive-big : MDEV-10615 - table is marked as crashed
archive.archive_bitfield : MDEV-11771 - table is marked as crashed
archive.archive_symlink : MDEV-12170 - unexpected error on rmdir
archive.discover : MDEV-10510 - table is marked as crashed
archive.mysqlhotcopy_archive : MDEV-10995 - test hangs on debug build
#----------------------------------------------------------------
binlog.binlog_commit_wait : MDEV-10150 - Error: too much time elapsed
binlog.binlog_max_binlog_stmt_cache_size : Added in 10.0.30
binlog.binlog_xa_recover : MDEV-8517 - Extra checkpoint
#----------------------------------------------------------------
connect.jdbc : re-enabled in 10.0.29
connect.jdbc_new : re-enabled in 10.0.29
connect.tbl : MDEV-9844, MDEV-10179 - sporadic crashes, valgrind warnings, wrong results
connect.xml : Uses xsample2.xml modified in 10.0.30
connect.xml_zip : Added in 10.0.30
connect.zip : Added in 10.0.30
#----------------------------------------------------------------
@ -102,6 +86,7 @@ engines/rr_trx.* : MDEV-10998 - tests not maintained
#----------------------------------------------------------------
federated_bug_35333 : Modified in 10.0.30
federated.federatedx : MDEV-10617 - Wrong checksum, timeouts
federated.federated_innodb : MDEV-10617, MDEV-10417 - Wrong checksum, timeouts, fails on Mips
federated.federated_partition : MDEV-10417 - Fails on Mips
@ -110,22 +95,28 @@ federated.federated_transactions : MDEV-10617, MDEV-10417 - Wrong checksum, time
#----------------------------------------------------------------
funcs_1.memory_views : MDEV-11773 - timeout
funcs_1.processlist_val_ps : MDEV-12175 - Wrong result
funcs_2/charset.* : MDEV-10999 - test not maintained
#----------------------------------------------------------------
innodb.alter_key_block_size-11757 : Added in 10.0.30
innodb.binlog_consistent : MDEV-10618 - Server fails to start
innodb.group_commit_crash_no_optimize_thread : MDEV-11770 - checksum mismatch
innodb.innodb-alter-table : MDEV-10619 - Testcase timeout
innodb.innodb_blob_unrecoverable_crash : Modified in 10.0.30
innodb.innodb_bug14676111 : Modified in 10.0.30
innodb.innodb_bug30423 : MDEV-7311 - Wrong number of rows in the plan
innodb.innodb_bug53290 : MDEV-11767 - timeout
innodb.innodb_bug56143 : MDEV-11766 - unexpected warnings
innodb.innodb_bug59641 : Modified in 10.0.30
innodb.innodb-get-fk : Modified in 10.0.30
innodb.innodb_monitor : MDEV-10939 - Testcase timeout
innodb.innodb-wl5522-debug-zip : Modified in 10.0.29
innodb.table_index_statistics : Modified in 10.0.29
innodb.log_file_size : Added in 10.0.30
innodb.read_only_recovery : Added in 10.0.30
innodb.xa_recovery : Modified in 10.0.30
innodb_fts.innodb_fts_misc : MDEV-11767 - timeout
innodb_fts.innodb_fts_plugin : MDEV-11766 - unexpected warnings
innodb_fts.create : Added in 10.0.30
innodb_fts.innodb_fts_stopword_charset : MDEV-12052 - Crash on shutdown
#----------------------------------------------------------------
@ -138,28 +129,43 @@ mroonga/storage.index_multiple_column_unique_date_order_32bit_desc : Wrong resul
#----------------------------------------------------------------
multi_source.gtid : MDEV-10620, MDEV-10417 - Timeout in wait condition, fails on Mips
multi_source.gtid : MDEV-10417 - Fails on Mips
multi_source.multisource : MDEV-10417 - Fails on Mips
multi_source.simple : MDEV-4633 - Wrong slave status output
multi_source.status_vars : MDEV-4632 - failed while waiting for Slave_received_heartbeats
#----------------------------------------------------------------
oqgraph.regression_mdev6282 : Modified in 10.0.30
oqgraph.regression_mdev6345 : Modified in 10.0.30
#----------------------------------------------------------------
parts.partition_bigint_innodb : Added in 10.0.30
parts.partition_bigint_myisam : Added in 10.0.30
parts.partition_double_innodb : Added in 10.0.30
parts.partition_double_myisam : Added in 10.0.30
parts.partition_exch_qa_10 : MDEV-11765 - wrong result
parts.partition_float_myisam : MDEV-10621 - Testcase timeout
parts.partition_int_myisam : MDEV-10621 - Testcase timeout
#----------------------------------------------------------------
percona.percona_xtradb_bug317074 : MDEV-11767 - timeout
parts.partition_float_innodb : Modified in 10.0.30
parts.partition_float_myisam : Modified in 10.0.30
parts.partition_int_innodb : Modified in 10.0.30
parts.partition_int_myisam : Modified in 10.0.30
parts.partition_mediumint_innodb : Added in 10.0.30
parts.partition_mediumint_myisam : Added in 10.0.30
parts.partition_smallint_innodb : Added in 10.0.30
parts.partition_smallint_myisam : Added in 10.0.30
parts.partition_tinyint_innodb : Added in 10.0.30
parts.partition_tinyint_myisam : Added in 10.0.30
#----------------------------------------------------------------
perfschema.func_file_io : MDEV-5708 - fails for s390x
perfschema.func_mutex : MDEV-5708 - fails for s390x
perfschema.hostcache_ipv6_ssl : MDEV-10696 - crash on shutdown
perfschema.table_name : MDEV-11764 - wrong result
perfschema.socket_summary_by_event_name_func : MDEV-10622 - Socket summary tables do not match
perfschema.stage_mdl_procedure : MDEV-11545 - Wrong result
perfschema.threads_mysql : MDEV-12177 - Wrong result
perfschema_stress.* : MDEV-10996 - tests not maintained
@ -169,49 +175,41 @@ plugins.feedback_plugin_send : MDEV-7932 - ssl failed for url, MDEV-11118 -
plugins.server_audit : MDEV-9562 - crashes on sol10-sparc
plugins.thread_pool_server_audit : MDEV-9562 - crashes on sol10-sparc
#----------------------------------------------------------------
roles.create_and_drop_role : Modified in 10.0.29
roles.create_and_grant_role : MDEV-11772 - wrong result
roles.role_case_sensitive-10744 : Added in 10.0.29
#----------------------------------------------------------------
rpl.last_insert_id : MDEV-10625 - warnings in error log
rpl.rpl_alter_extra_persistent : Added in 10.0.29
rpl.rpl_auto_increment : MDEV-10417 - Fails on Mips
rpl.rpl_auto_increment_bug45679 : MDEV-10417 - Fails on Mips
rpl.rpl_auto_increment_update_failure : MDEV-10625 - warnings in error log
rpl.rpl_binlog_index : MDEV-9501 - Warning: failed registering on master
rpl.rpl_checksum_cache : MDEV-10626 - Testcase timeout
rpl.rpl_circular_for_4_hosts : MDEV-10627 - Testcase timeout
rpl.rpl_checksum_cache : MDEV-12173 - InnoDB error
rpl.rpl_ddl : MDEV-10417 - Fails on Mips
rpl.rpl_gtid_crash : MDEV-9501 - Warning: failed registering on master
rpl.rpl_gtid_master_promote : MDEV-10628 - Timeout in sync_with_master
rpl.rpl_gtid_stop_start : MDEV-10629 - Crash on shutdown
rpl.rpl_gtid_until : MDEV-10625 - warnings in error log
rpl.rpl_heartbeat_basic : MDEV-11668 - Wrong result
rpl.rpl_heartbeat_basic : Modified in 10.0.30
rpl.rpl_innodb_bug30888 : MDEV-10417 - Fails on Mips
rpl.rpl_insert : MDEV-9329 - Fails on Ubuntu/s390x
rpl.rpl_insert_delayed : MDEV-9329 - Fails on Ubuntu/s390x
rpl.rpl_invoked_features : MDEV-10417 - Fails on Mips
rpl.rpl_mdev10863 : Added in 10.0.29
rpl.rpl_mdev6020 : MDEV-10630, MDEV-10417 - Timeouts, fails on Mips
rpl.rpl_mdev6386 : MDEV-10631 - Wrong result on slave
rpl.rpl_parallel : MDEV-10632, MDEV-10653 - Failures to sync, timeouts
rpl.rpl_mdev6386 : Modified in 10.0.30
rpl.rpl_parallel : MDEV-10653 - Timeouts
rpl.rpl_parallel_temptable : MDEV-10356 - Crash in close_thread_tables
rpl.rpl_partition_innodb : MDEV-10417 - Fails on Mips
rpl.rpl_row_drop_create_temp_table : MDEV-10626 - Testcase timeout
rpl.rpl_row_mysqlbinlog : Modified in 10.0.29
rpl.rpl_row_basic_11bugs : MDEV-12171 - Server failed to start
rpl.rpl_row_sp001 : MDEV-9329 - Fails on Ubuntu/s390x
rpl.rpl_semi_sync : MDEV-11220 - Wrong result
rpl.rpl_semi_sync_uninstall_plugin : MDEV-7140 - Wrong plugin status
rpl.rpl_show_slave_hosts : MDEV-12171 - Server failed to start
rpl.rpl_slave_grp_exec : MDEV-10514 - Unexpected deadlock
rpl.rpl_special_charset : Modified in 10.0.29
rpl.rpl_sync : MDEV-10633 - Database page corruption
rpl.rpl_temporary_error2 : MDEV-10634 - Wrong number of retries
rpl.rpl_skip_replication : MDEV-9268 - Fails with timeout in sync_slave_with_master on Alpha
rpl.sec_behind_master-5114 : Modified in 10.0.29
rpl/extra/rpl_tests.* : MDEV-10994 - tests not maintained
@ -240,28 +238,31 @@ stress.ddl_innodb : MDEV-10635 - Testcase timeout
sys_vars.autocommit_func2 : MDEV-9329 - Fails on Ubuntu/s390x
sys_vars.innodb_buffer_pool_dump_pct_basic : MDEV-10651 - sporadic failure on file_exists
sys_vars.replicate_do_db_basic : Modified in 10.0.29
sys_vars.replicate_do_table_basic : Modified in 10.0.29
sys_vars.replicate_ignore_db_basic : Modified in 10.0.29
sys_vars.replicate_ignore_table_basic : Modified in 10.0.29
sys_vars.replicate_wild_do_table_basic : Modified in 10.0.29
sys_vars.replicate_wild_ignore_table_basic : Modified in 10.0.29
sys_vars.innodb_force_recovery_crash_basic : Modified in 10.0.30
sys_vars.innodb_stats_include_delete_marked_basic : Added in 10.0.30
sys_vars.innodb_status_output_basic : MDEV-12174 - Timeout
sys_vars.secure_file_priv : Modified in 10.0.30
sys_vars.thread_cache_size_func : MDEV-11775 - wrong result
#----------------------------------------------------------------
tokudb.cluster_filter_unpack_varchar : MDEV-10636 - Wrong execution plan
tokudb.dir_per_db : MDEV-11537 - wrong result
tokudb.locks-select-update-3 : MDEV-11774 - lock wait timeout
tokudb.table_index_statistics : Added in 10.0.29
tokudb.dir_per_db_rename_to_nonexisting_schema : Added in 10.0.30
tokudb.gap_lock_error : Added in 10.0.30
tokudb.locks-select-update-3 : Modified in 10.0.30
tokudb.percona_kill_idle_trx_tokudb : Added in 10.0.30
tokudb_backup.* : MDEV-11001 - tests don't work
tokudb_bugs.checkpoint_lock : MDEV-10637 - Wrong processlist output
tokudb_bugs.checkpoint_lock_3 : MDEV-10637 - Wrong processlist output
tokudb_bugs.xa : MDEV-11804 - Lock wait timeout
tokudb_rpl.* : MDEV-11001 - tests don't work
tokudb_sys_vars.* : MDEV-11001 - tests don't work
rpl-tokudb.rpl_extra_col_slave_tokudb : Result file modified in 10.0.30
#----------------------------------------------------------------
unit.ma_test_loghandler : MDEV-10638 - record read not ok
@ -271,5 +272,10 @@ unit.pfs : MySQL:84457 - unittest pft-t failing
vcol.not_supported : MDEV-10639 - Testcase timeout
vcol.vcol_keys_innodb : MDEV-10639 - Testcase timeout
vcol.vcol_misc : Modified in 10.0.30
vcol.vcol_select_myisam : Modified in 10.0.30
vcol.vcol_trigger_sp_innodb : Include file modified in 10.0.30
vcol.vcol_trigger_sp_myisam : Include file modified in 10.0.30
vcol.wrong_arena : Added in 10.0.30
#----------------------------------------------------------------

View File

@ -1144,6 +1144,17 @@
...
fun:pthread_create*
}
<<<<<<< HEAD
{
Memory Leak in loader and valgrind malloc
Memcheck:Leak
match-leak-kinds:reachable
obj:*/vgpreload_memcheck*.so
...
obj:*/ld-*.so
...
}
{
ConnectSE: unixODBC SQLAllocEnv leaves some "still reachable" pointers

View File

@ -97,13 +97,8 @@ char * fn_format(char * to, const char *name, const char *dir,
pos=strmake(strmov(to,dev),name,length);
(void) strmov(pos,ext); /* Don't convert extension */
}
/*
If MY_RETURN_REAL_PATH and MY_RESOLVE_SYMLINK is given, only do
realpath if the file is a symbolic link
*/
if (flag & MY_RETURN_REAL_PATH)
(void) my_realpath(to, to, MYF(flag & MY_RESOLVE_SYMLINKS ?
MY_RESOLVE_LINK: 0));
(void) my_realpath(to, to, MYF(0));
else if (flag & MY_RESOLVE_SYMLINKS)
{
strmov(buff,to);

View File

@ -36,7 +36,7 @@
File my_create(const char *FileName, int CreateFlags, int access_flags,
myf MyFlags)
{
int fd, rc;
int fd;
DBUG_ENTER("my_create");
DBUG_PRINT("my",("Name: '%s' CreateFlags: %d AccessFlags: %d MyFlags: %lu",
FileName, CreateFlags, access_flags, MyFlags));
@ -54,21 +54,7 @@ File my_create(const char *FileName, int CreateFlags, int access_flags,
fd= -1;
}
rc= my_register_filename(fd, FileName, FILE_BY_CREATE,
fd= my_register_filename(fd, FileName, FILE_BY_CREATE,
EE_CANTCREATEFILE, MyFlags);
/*
my_register_filename() may fail on some platforms even if the call to
*open() above succeeds. In this case, don't leave the stale file because
callers assume the file to not exist if my_create() fails, so they don't
do any cleanups.
*/
if (unlikely(fd >= 0 && rc < 0))
{
int tmp= my_errno;
my_close(fd, MyFlags);
my_delete(FileName, MyFlags);
my_errno= tmp;
}
DBUG_RETURN(rc);
DBUG_RETURN(fd);
} /* my_create */

View File

@ -21,6 +21,12 @@
static int my_win_unlink(const char *name);
#endif
CREATE_NOSYMLINK_FUNCTION(
unlink_nosymlinks(const char *pathname),
unlinkat(dfd, filename, 0),
unlink(pathname)
);
int my_delete(const char *name, myf MyFlags)
{
int err;
@ -30,6 +36,9 @@ int my_delete(const char *name, myf MyFlags)
#ifdef _WIN32
err = my_win_unlink(name);
#else
if (MyFlags & MY_NOSYMLINKS)
err= unlink_nosymlinks(name);
else
err= unlink(name);
#endif

View File

@ -27,7 +27,7 @@
char * my_filename(File fd)
{
DBUG_ENTER("my_filename");
if ((uint) fd >= (uint) my_file_limit)
if ((uint) fd >= (uint) my_file_limit || !my_file_info[fd].name)
DBUG_RETURN((char*) "UNKNOWN");
if (fd >= 0 && my_file_info[fd].type != UNOPEN)
{

View File

@ -69,9 +69,7 @@ FILE *my_fopen(const char *filename, int flags, myf MyFlags)
DBUG_RETURN(fd); /* safeguard */
}
mysql_mutex_lock(&THR_LOCK_open);
if ((my_file_info[filedesc].name= (char*)
my_strdup(filename,MyFlags)))
{
my_file_info[filedesc].name= (char*) my_strdup(filename,MyFlags);
my_stream_opened++;
my_file_total_opened++;
my_file_info[filedesc].type= STREAM_BY_FOPEN;
@ -79,10 +77,6 @@ FILE *my_fopen(const char *filename, int flags, myf MyFlags)
DBUG_PRINT("exit",("stream: 0x%lx", (long) fd));
DBUG_RETURN(fd);
}
mysql_mutex_unlock(&THR_LOCK_open);
(void) my_fclose(fd,MyFlags);
my_errno=ENOMEM;
}
else
my_errno=errno;
DBUG_PRINT("error",("Got error %d on open",my_errno));

View File

@ -227,7 +227,7 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
/* At very last, delete mysys key, it is used everywhere including DBUG */
pthread_key_delete(THR_KEY_mysys);
my_init_done=0;
my_init_done= my_thr_key_mysys_exists= 0;
} /* my_end */
#ifndef DBUG_OFF

View File

@ -15,9 +15,14 @@
#include "mysys_priv.h"
#include "mysys_err.h"
#include <my_dir.h>
#include <m_string.h>
#include <errno.h>
CREATE_NOSYMLINK_FUNCTION(
open_nosymlinks(const char *pathname, int flags, int mode),
openat(dfd, filename, O_NOFOLLOW | flags, mode),
open(pathname, O_NOFOLLOW | flags, mode)
);
/*
Open a file
@ -45,10 +50,11 @@ File my_open(const char *FileName, int Flags, myf MyFlags)
MyFlags|= my_global_flags;
#if defined(_WIN32)
fd= my_win_open(FileName, Flags);
#elif !defined(NO_OPEN_3)
fd = open(FileName, Flags, my_umask); /* Normal unix */
#else
fd = open((char *) FileName, Flags);
if (MyFlags & MY_NOSYMLINKS)
fd = open_nosymlinks(FileName, Flags, my_umask);
else
fd = open(FileName, Flags, my_umask);
#endif
fd= my_register_filename(fd, FileName, FILE_BY_OPEN,
@ -131,11 +137,8 @@ File my_register_filename(File fd, const char *FileName, enum file_type
thread_safe_increment(my_file_opened,&THR_LOCK_open);
DBUG_RETURN(fd); /* safeguard */
}
else
{
mysql_mutex_lock(&THR_LOCK_open);
if ((my_file_info[fd].name = (char*) my_strdup(FileName,MyFlags)))
{
my_file_info[fd].name = (char*) my_strdup(FileName, MyFlags);
my_file_opened++;
my_file_total_opened++;
my_file_info[fd].type = type_of_file;
@ -143,12 +146,6 @@ File my_register_filename(File fd, const char *FileName, enum file_type
DBUG_PRINT("exit",("fd: %d",fd));
DBUG_RETURN(fd);
}
mysql_mutex_unlock(&THR_LOCK_open);
my_errno= ENOMEM;
}
(void) my_close(fd, MyFlags);
}
else
my_errno= errno;
DBUG_PRINT("error",("Got error %d on open", my_errno));

View File

@ -1,5 +1,6 @@
/*
Copyright (c) 2001, 2011, Oracle and/or its affiliates
Copyright (c) 2010, 2017, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -23,6 +24,14 @@
#include <sys/stat.h>
#endif
static int always_valid(const char *filename __attribute__((unused)))
{
return 0;
}
int (*mysys_test_invalid_symlink)(const char *filename)= always_valid;
/*
Reads the content of a symbolic link
If the file is not a symbolic link, return the original file name in to.
@ -120,6 +129,11 @@ int my_is_symlink(const char *filename __attribute__((unused)))
to is guaranteed to never set to a string longer than FN_REFLEN
(including the end \0)
On error returns -1, unless error is file not found, in which case it
is 1.
Sets my_errno to specific error number.
*/
int my_realpath(char *to, const char *filename, myf MyFlags)
@ -145,6 +159,9 @@ int my_realpath(char *to, const char *filename, myf MyFlags)
if (MyFlags & MY_WME)
my_error(EE_REALPATH, MYF(0), filename, my_errno);
my_load_path(to, filename, NullS);
if (my_errno == ENOENT)
result= 1;
else
result= -1;
}
DBUG_RETURN(result);
@ -168,3 +185,78 @@ int my_realpath(char *to, const char *filename, myf MyFlags)
#endif
return 0;
}
#ifdef HAVE_OPEN_PARENT_DIR_NOSYMLINKS
/** opens the parent dir. walks the path, and does not resolve symlinks
returns the pointer to the file name (basename) within the pathname
or NULL in case of an error
stores the parent dir (dirname) file descriptor in pdfd.
It can be -1 even if there was no error!
This is used for symlinked tables for DATA/INDEX DIRECTORY.
The paths there have been realpath()-ed. So, we can assume here that
* `pathname` is an absolute path
* no '.', '..', and '//' in the path
* file exists
*/
const char *my_open_parent_dir_nosymlinks(const char *pathname, int *pdfd)
{
char buf[PATH_MAX+1];
char *s= buf, *e= buf+1, *end= strnmov(buf, pathname, sizeof(buf));
int fd, dfd= -1;
if (*end)
{
errno= ENAMETOOLONG;
return NULL;
}
if (*s != '/') /* not an absolute path */
{
errno= ENOENT;
return NULL;
}
for (;;)
{
if (*e == '/') /* '//' in the path */
{
errno= ENOENT;
goto err;
}
while (*e && *e != '/')
e++;
*e= 0;
if (!memcmp(s, ".", 2) || !memcmp(s, "..", 3))
{
errno= ENOENT;
goto err;
}
if (++e >= end)
{
*pdfd= dfd;
return pathname + (s - buf);
}
fd = openat(dfd, s, O_NOFOLLOW | O_PATH);
if (fd < 0)
goto err;
if (dfd >= 0)
close(dfd);
dfd= fd;
s= e;
}
err:
if (dfd >= 0)
close(dfd);
return NULL;
}
#endif

View File

@ -91,27 +91,6 @@ File my_create_with_symlink(const char *linkname, const char *filename,
DBUG_RETURN(file);
}
/*
If the file was a symlink, delete both symlink and the file which the
symlink pointed to.
*/
int my_delete_with_symlink(const char *name, myf MyFlags)
{
char link_name[FN_REFLEN];
int was_symlink= (!my_disable_symlinks &&
!my_readlink(link_name, name, MYF(0)));
int result;
DBUG_ENTER("my_delete_with_symlink");
if (!(result=my_delete(name, MyFlags)))
{
if (was_symlink)
result=my_delete(link_name, MyFlags);
}
DBUG_RETURN(result);
}
/*
If the file is a normal file, just rename it.
If the file is a symlink:
@ -182,3 +161,31 @@ int my_rename_with_symlink(const char *from, const char *to, myf MyFlags)
DBUG_RETURN(result);
#endif /* HAVE_READLINK */
}
/** delete a - possibly symlinked - table file
This is used to delete a file that is part of a table (e.g. MYI or MYD
file of MyISAM) when dropping a table. A file might be a symlink -
if the table was created with DATA DIRECTORY or INDEX DIRECTORY -
in this case both the symlink and the symlinked file are deleted,
but only if the symlinked file is not in the datadir.
*/
int my_handler_delete_with_symlink(PSI_file_key key, const char *name,
const char *ext, myf sync_dir)
{
char orig[FN_REFLEN], real[FN_REFLEN];
int res= 0;
DBUG_ENTER("my_handler_delete_with_symlink");
fn_format(orig, name, "", ext, MY_UNPACK_FILENAME | MY_APPEND_EXT);
if (my_is_symlink(orig))
{
/*
Delete the symlinked file only if the symlink is not
pointing into datadir.
*/
if (!(my_realpath(real, orig, MYF(0)) || mysys_test_invalid_symlink(real)))
res= mysql_file_delete(key, real, MYF(MY_NOSYMLINKS | sync_dir));
}
DBUG_RETURN(mysql_file_delete(key, orig, MYF(sync_dir)) || res);
}

View File

@ -196,7 +196,7 @@ int my_sync_dir_by_file(const char *file_name __attribute__((unused)),
char dir_name[FN_REFLEN];
size_t dir_name_length;
dirname_part(dir_name, file_name, &dir_name_length);
return my_sync_dir(dir_name, my_flags);
return my_sync_dir(dir_name, my_flags & ~MY_NOSYMLINKS);
#else
return 0;
#endif

View File

@ -44,6 +44,8 @@ static uint get_thread_lib(void);
/** True if @c my_thread_global_init() has been called. */
static my_bool my_thread_global_init_done= 0;
/* True if THR_KEY_mysys is created */
my_bool my_thr_key_mysys_exists= 0;
/*
@ -167,11 +169,20 @@ my_bool my_thread_global_init(void)
return 0;
my_thread_global_init_done= 1;
if ((pth_ret= pthread_key_create(&THR_KEY_mysys, NULL)) != 0)
/*
THR_KEY_mysys is deleted in my_end() as DBUG libraries are using it even
after my_thread_global_end() is called.
my_thr_key_mysys_exist is used to protect against application like QT
that calls my_thread_global_init() + my_thread_global_end() multiple times
without calling my_init() + my_end().
*/
if (!my_thr_key_mysys_exists &&
(pth_ret= pthread_key_create(&THR_KEY_mysys, NULL)) != 0)
{
fprintf(stderr, "Can't initialize threads: error %d\n", pth_ret);
return 1;
}
my_thr_key_mysys_exists= 1;
/* Mutex used by my_thread_init() and after my_thread_destroy_mutex() */
my_thread_init_internal_mutex();

View File

@ -92,6 +92,34 @@ size_t sf_malloc_usable_size(void *ptr, my_bool *is_thread_specific);
void my_error_unregister_all(void);
#if !defined(O_PATH) && defined(O_EXEC) /* FreeBSD */
#define O_PATH O_EXEC
#endif
#ifdef O_PATH
#define HAVE_OPEN_PARENT_DIR_NOSYMLINKS
const char *my_open_parent_dir_nosymlinks(const char *pathname, int *pdfd);
#define NOSYMLINK_FUNCTION_BODY(AT,NOAT) \
int dfd, res; \
const char *filename= my_open_parent_dir_nosymlinks(pathname, &dfd); \
if (filename == NULL) return -1; \
res= AT; \
if (dfd >= 0) close(dfd); \
return res;
#elif defined(HAVE_REALPATH)
#define NOSYMLINK_FUNCTION_BODY(AT,NOAT) \
char buf[PATH_MAX+1]; \
if (realpath(pathname, buf) == NULL) return -1; \
if (strcmp(pathname, buf)) { errno= ENOTDIR; return -1; } \
return NOAT;
#else
#define NOSYMLINK_FUNCTION_BODY(AT,NOAT) \
return NOAT;
#endif
#define CREATE_NOSYMLINK_FUNCTION(PROTO,AT,NOAT) \
static int PROTO { NOSYMLINK_FUNCTION_BODY(AT,NOAT) }
#ifdef _WIN32
#include <sys/stat.h>
/* my_winfile.c exports, should not be used outside mysys */

View File

@ -8,7 +8,7 @@ Email domain: cam.ac.uk
University of Cambridge Computing Service,
Cambridge, England.
Copyright (c) 1997-2016 University of Cambridge
Copyright (c) 1997-2017 University of Cambridge
All rights reserved
@ -19,7 +19,7 @@ Written by: Zoltan Herczeg
Email local part: hzmester
Emain domain: freemail.hu
Copyright(c) 2010-2016 Zoltan Herczeg
Copyright(c) 2010-2017 Zoltan Herczeg
All rights reserved.
@ -30,7 +30,7 @@ Written by: Zoltan Herczeg
Email local part: hzmester
Emain domain: freemail.hu
Copyright(c) 2009-2016 Zoltan Herczeg
Copyright(c) 2009-2017 Zoltan Herczeg
All rights reserved.

View File

@ -66,6 +66,7 @@
# 2013-10-08 PH got rid of the "source" command, which is a bash-ism (use ".")
# 2013-11-05 PH added support for PARENS_NEST_LIMIT
# 2016-03-01 PH applied Chris Wilson's patch for MSVC static build
# 2016-06-24 PH applied Chris Wilson's revised patch (adds a separate option)
PROJECT(PCRE C CXX)

View File

@ -4,6 +4,53 @@ ChangeLog for PCRE
Note that the PCRE 8.xx series (PCRE1) is now in a bugfix-only state. All
development is happening in the PCRE2 10.xx series.
Version 8.40 11-January-2017
----------------------------
1. Using -o with -M in pcregrep could cause unnecessary repeated output when
the match extended over a line boundary.
2. Applied Chris Wilson's second patch (Bugzilla #1681) to CMakeLists.txt for
MSVC static compilation, putting the first patch under a new option.
3. Fix register overwite in JIT when SSE2 acceleration is enabled.
4. Ignore "show all captures" (/=) for DFA matching.
5. Fix JIT unaligned accesses on x86. Patch by Marc Mutz.
6. In any wide-character mode (8-bit UTF or any 16-bit or 32-bit mode),
without PCRE_UCP set, a negative character type such as \D in a positive
class should cause all characters greater than 255 to match, whatever else
is in the class. There was a bug that caused this not to happen if a
Unicode property item was added to such a class, for example [\D\P{Nd}] or
[\W\pL].
7. When pcretest was outputing information from a callout, the caret indicator
for the current position in the subject line was incorrect if it was after
an escape sequence for a character whose code point was greater than
\x{ff}.
8. A pattern such as (?<RA>abc)(?(R)xyz) was incorrectly compiled such that
the conditional was interpreted as a reference to capturing group 1 instead
of a test for recursion. Any group whose name began with R was
misinterpreted in this way. (The reference interpretation should only
happen if the group's name is precisely "R".)
9. A number of bugs have been mended relating to match start-up optimizations
when the first thing in a pattern is a positive lookahead. These all
applied only when PCRE_NO_START_OPTIMIZE was *not* set:
(a) A pattern such as (?=.*X)X$ was incorrectly optimized as if it needed
both an initial 'X' and a following 'X'.
(b) Some patterns starting with an assertion that started with .* were
incorrectly optimized as having to match at the start of the subject or
after a newline. There are cases where this is not true, for example,
(?=.*[A-Z])(?=.{8,16})(?!.*[\s]) matches after the start in lines that
start with spaces. Starting .* in an assertion is no longer taken as an
indication of matching at the start (or after a newline).
Version 8.39 14-June-2016
-------------------------

View File

@ -25,7 +25,7 @@ Email domain: cam.ac.uk
University of Cambridge Computing Service,
Cambridge, England.
Copyright (c) 1997-2016 University of Cambridge
Copyright (c) 1997-2017 University of Cambridge
All rights reserved.
@ -36,7 +36,7 @@ Written by: Zoltan Herczeg
Email local part: hzmester
Emain domain: freemail.hu
Copyright(c) 2010-2016 Zoltan Herczeg
Copyright(c) 2010-2017 Zoltan Herczeg
All rights reserved.
@ -47,7 +47,7 @@ Written by: Zoltan Herczeg
Email local part: hzmester
Emain domain: freemail.hu
Copyright(c) 2009-2016 Zoltan Herczeg
Copyright(c) 2009-2017 Zoltan Herczeg
All rights reserved.

View File

@ -1,6 +1,12 @@
News about PCRE releases
------------------------
Release 8.40 11-January-2017
----------------------------
This is a bug-fix release.
Release 8.39 14-June-2016
-------------------------

View File

@ -9,17 +9,17 @@ dnl The PCRE_PRERELEASE feature is for identifying release candidates. It might
dnl be defined as -RC2, for example. For real releases, it should be empty.
m4_define(pcre_major, [8])
m4_define(pcre_minor, [39])
m4_define(pcre_minor, [40])
m4_define(pcre_prerelease, [])
m4_define(pcre_date, [2016-06-14])
m4_define(pcre_date, [2017-01-11])
# NOTE: The CMakeLists.txt file searches for the above variables in the first
# 50 lines of this file. Please update that if the variables above are moved.
# Libtool shared library interface versions (current:revision:age)
m4_define(libpcre_version, [3:7:2])
m4_define(libpcre16_version, [2:7:2])
m4_define(libpcre32_version, [0:7:0])
m4_define(libpcre_version, [3:8:2])
m4_define(libpcre16_version, [2:8:2])
m4_define(libpcre32_version, [0:8:0])
m4_define(libpcreposix_version, [0:4:0])
m4_define(libpcrecpp_version, [0:1:0])

View File

@ -128,7 +128,7 @@ the pattern /^(a(b)?)+$/ in Perl leaves $2 unset, but in PCRE it is set to "b".
14. PCRE's handling of duplicate subpattern numbers and duplicate subpattern
names is not as general as Perl's. This is a consequence of the fact the PCRE
works internally just with numbers, using an external table to translate
between numbers and names. In particular, a pattern such as (?|(?&#60;a&#62;A)|(?&#60;b)B),
between numbers and names. In particular, a pattern such as (?|(?&#60;a&#62;A)|(?&#60;b&#62;B),
where the two capturing parentheses have the same number but different names,
is not supported, and causes an error at compile time. If it were allowed, it
would not be possible to distinguish which parentheses matched, because both

View File

@ -358,24 +358,24 @@ When PCRE is compiled in EBCDIC mode, \a, \e, \f, \n, \r, and \t
generate the appropriate EBCDIC code values. The \c escape is processed
as specified for Perl in the <b>perlebcdic</b> document. The only characters
that are allowed after \c are A-Z, a-z, or one of @, [, \, ], ^, _, or ?. Any
other character provokes a compile-time error. The sequence \@ encodes
character code 0; the letters (in either case) encode characters 1-26 (hex 01
to hex 1A); [, \, ], ^, and _ encode characters 27-31 (hex 1B to hex 1F), and
\? becomes either 255 (hex FF) or 95 (hex 5F).
other character provokes a compile-time error. The sequence \c@ encodes
character code 0; after \c the letters (in either case) encode characters 1-26
(hex 01 to hex 1A); [, \, ], ^, and _ encode characters 27-31 (hex 1B to hex
1F), and \c? becomes either 255 (hex FF) or 95 (hex 5F).
</P>
<P>
Thus, apart from \?, these escapes generate the same character code values as
Thus, apart from \c?, these escapes generate the same character code values as
they do in an ASCII environment, though the meanings of the values mostly
differ. For example, \G always generates code value 7, which is BEL in ASCII
differ. For example, \cG always generates code value 7, which is BEL in ASCII
but DEL in EBCDIC.
</P>
<P>
The sequence \? generates DEL (127, hex 7F) in an ASCII environment, but
The sequence \c? generates DEL (127, hex 7F) in an ASCII environment, but
because 127 is not a control character in EBCDIC, Perl makes it generate the
APC character. Unfortunately, there are several variants of EBCDIC. In most of
them the APC character has the value 255 (hex FF), but in the one Perl calls
POSIX-BC its value is 95 (hex 5F). If certain other characters have POSIX-BC
values, PCRE makes \? generate 95; otherwise it generates 255.
values, PCRE makes \c? generate 95; otherwise it generates 255.
</P>
<P>
After \0 up to two further octal digits are read. If there are fewer than two
@ -1512,13 +1512,8 @@ J, U and X respectively.
<P>
When one of these option changes occurs at top level (that is, not inside
subpattern parentheses), the change applies to the remainder of the pattern
that follows. If the change is placed right at the start of a pattern, PCRE
extracts it into the global options (and it will therefore show up in data
extracted by the <b>pcre_fullinfo()</b> function).
</P>
<P>
An option change within a subpattern (see below for a description of
subpatterns) affects only that part of the subpattern that follows it, so
that follows. An option change within a subpattern (see below for a description
of subpatterns) affects only that part of the subpattern that follows it, so
<pre>
(a(?i)b)c
</pre>
@ -2160,6 +2155,14 @@ capturing is carried out only for positive assertions. (Perl sometimes, but not
always, does do capturing in negative assertions.)
</P>
<P>
WARNING: If a positive assertion containing one or more capturing subpatterns
succeeds, but failure to match later in the pattern causes backtracking over
this assertion, the captures within the assertion are reset only if no higher
numbered captures are already set. This is, unfortunately, a fundamental
limitation of the current implementation, and as PCRE1 is now in
maintenance-only status, it is unlikely ever to change.
</P>
<P>
For compatibility with Perl, assertion subpatterns may be repeated; though
it makes no sense to assert the same thing several times, the side effect of
capturing parentheses may occasionally be useful. In practice, there only three
@ -3264,9 +3267,9 @@ Cambridge CB2 3QH, England.
</P>
<br><a name="SEC30" href="#TOC1">REVISION</a><br>
<P>
Last updated: 14 June 2015
Last updated: 23 October 2016
<br>
Copyright &copy; 1997-2015 University of Cambridge.
Copyright &copy; 1997-2016 University of Cambridge.
<br>
<p>
Return to the <a href="index.html">PCRE index page</a>.

View File

@ -4640,7 +4640,7 @@ DIFFERENCES BETWEEN PCRE AND PERL
pattern names is not as general as Perl's. This is a consequence of the
fact the PCRE works internally just with numbers, using an external ta-
ble to translate between numbers and names. In particular, a pattern
such as (?|(?<a>A)|(?<b)B), where the two capturing parentheses have
such as (?|(?<a>A)|(?<b>B), where the two capturing parentheses have
the same number but different names, is not supported, and causes an
error at compile time. If it were allowed, it would not be possible to
distinguish which parentheses matched, because both names map to cap-
@ -5028,22 +5028,23 @@ BACKSLASH
ate the appropriate EBCDIC code values. The \c escape is processed as
specified for Perl in the perlebcdic document. The only characters that
are allowed after \c are A-Z, a-z, or one of @, [, \, ], ^, _, or ?.
Any other character provokes a compile-time error. The sequence \@
encodes character code 0; the letters (in either case) encode charac-
ters 1-26 (hex 01 to hex 1A); [, \, ], ^, and _ encode characters 27-31
(hex 1B to hex 1F), and \? becomes either 255 (hex FF) or 95 (hex 5F).
Any other character provokes a compile-time error. The sequence \c@
encodes character code 0; after \c the letters (in either case) encode
characters 1-26 (hex 01 to hex 1A); [, \, ], ^, and _ encode characters
27-31 (hex 1B to hex 1F), and \c? becomes either 255 (hex FF) or 95
(hex 5F).
Thus, apart from \?, these escapes generate the same character code
Thus, apart from \c?, these escapes generate the same character code
values as they do in an ASCII environment, though the meanings of the
values mostly differ. For example, \G always generates code value 7,
values mostly differ. For example, \cG always generates code value 7,
which is BEL in ASCII but DEL in EBCDIC.
The sequence \? generates DEL (127, hex 7F) in an ASCII environment,
The sequence \c? generates DEL (127, hex 7F) in an ASCII environment,
but because 127 is not a control character in EBCDIC, Perl makes it
generate the APC character. Unfortunately, there are several variants
of EBCDIC. In most of them the APC character has the value 255 (hex
FF), but in the one Perl calls POSIX-BC its value is 95 (hex 5F). If
certain other characters have POSIX-BC values, PCRE makes \? generate
certain other characters have POSIX-BC values, PCRE makes \c? generate
95; otherwise it generates 255.
After \0 up to two further octal digits are read. If there are fewer
@ -6000,13 +6001,9 @@ INTERNAL OPTION SETTING
When one of these option changes occurs at top level (that is, not
inside subpattern parentheses), the change applies to the remainder of
the pattern that follows. If the change is placed right at the start of
a pattern, PCRE extracts it into the global options (and it will there-
fore show up in data extracted by the pcre_fullinfo() function).
An option change within a subpattern (see below for a description of
subpatterns) affects only that part of the subpattern that follows it,
so
the pattern that follows. An option change within a subpattern (see
below for a description of subpatterns) affects only that part of the
subpattern that follows it, so
(a(?i)b)c
@ -6621,6 +6618,14 @@ ASSERTIONS
assertions. (Perl sometimes, but not always, does do capturing in nega-
tive assertions.)
WARNING: If a positive assertion containing one or more capturing sub-
patterns succeeds, but failure to match later in the pattern causes
backtracking over this assertion, the captures within the assertion are
reset only if no higher numbered captures are already set. This is,
unfortunately, a fundamental limitation of the current implementation,
and as PCRE1 is now in maintenance-only status, it is unlikely ever to
change.
For compatibility with Perl, assertion subpatterns may be repeated;
though it makes no sense to assert the same thing several times, the
side effect of capturing parentheses may occasionally be useful. In
@ -7668,8 +7673,8 @@ AUTHOR
REVISION
Last updated: 14 June 2015
Copyright (c) 1997-2015 University of Cambridge.
Last updated: 23 October 2016
Copyright (c) 1997-2016 University of Cambridge.
------------------------------------------------------------------------------

View File

@ -113,7 +113,7 @@ the pattern /^(a(b)?)+$/ in Perl leaves $2 unset, but in PCRE it is set to "b".
14. PCRE's handling of duplicate subpattern numbers and duplicate subpattern
names is not as general as Perl's. This is a consequence of the fact the PCRE
works internally just with numbers, using an external table to translate
between numbers and names. In particular, a pattern such as (?|(?<a>A)|(?<b)B),
between numbers and names. In particular, a pattern such as (?|(?<a>A)|(?<b>B),
where the two capturing parentheses have the same number but different names,
is not supported, and causes an error at compile time. If it were allowed, it
would not be possible to distinguish which parentheses matched, because both

View File

@ -1,4 +1,4 @@
.TH PCREPATTERN 3 "14 June 2015" "PCRE 8.38"
.TH PCREPATTERN 3 "23 October 2016" "PCRE 8.40"
.SH NAME
PCRE - Perl-compatible regular expressions
.SH "PCRE REGULAR EXPRESSION DETAILS"
@ -336,22 +336,22 @@ When PCRE is compiled in EBCDIC mode, \ea, \ee, \ef, \en, \er, and \et
generate the appropriate EBCDIC code values. The \ec escape is processed
as specified for Perl in the \fBperlebcdic\fP document. The only characters
that are allowed after \ec are A-Z, a-z, or one of @, [, \e, ], ^, _, or ?. Any
other character provokes a compile-time error. The sequence \e@ encodes
character code 0; the letters (in either case) encode characters 1-26 (hex 01
to hex 1A); [, \e, ], ^, and _ encode characters 27-31 (hex 1B to hex 1F), and
\e? becomes either 255 (hex FF) or 95 (hex 5F).
other character provokes a compile-time error. The sequence \ec@ encodes
character code 0; after \ec the letters (in either case) encode characters 1-26
(hex 01 to hex 1A); [, \e, ], ^, and _ encode characters 27-31 (hex 1B to hex
1F), and \ec? becomes either 255 (hex FF) or 95 (hex 5F).
.P
Thus, apart from \e?, these escapes generate the same character code values as
Thus, apart from \ec?, these escapes generate the same character code values as
they do in an ASCII environment, though the meanings of the values mostly
differ. For example, \eG always generates code value 7, which is BEL in ASCII
differ. For example, \ecG always generates code value 7, which is BEL in ASCII
but DEL in EBCDIC.
.P
The sequence \e? generates DEL (127, hex 7F) in an ASCII environment, but
The sequence \ec? generates DEL (127, hex 7F) in an ASCII environment, but
because 127 is not a control character in EBCDIC, Perl makes it generate the
APC character. Unfortunately, there are several variants of EBCDIC. In most of
them the APC character has the value 255 (hex FF), but in the one Perl calls
POSIX-BC its value is 95 (hex 5F). If certain other characters have POSIX-BC
values, PCRE makes \e? generate 95; otherwise it generates 255.
values, PCRE makes \ec? generate 95; otherwise it generates 255.
.P
After \e0 up to two further octal digits are read. If there are fewer than two
digits, just those that are present are used. Thus the sequence \e0\ex\e015
@ -1511,12 +1511,8 @@ J, U and X respectively.
.P
When one of these option changes occurs at top level (that is, not inside
subpattern parentheses), the change applies to the remainder of the pattern
that follows. If the change is placed right at the start of a pattern, PCRE
extracts it into the global options (and it will therefore show up in data
extracted by the \fBpcre_fullinfo()\fP function).
.P
An option change within a subpattern (see below for a description of
subpatterns) affects only that part of the subpattern that follows it, so
that follows. An option change within a subpattern (see below for a description
of subpatterns) affects only that part of the subpattern that follows it, so
.sp
(a(?i)b)c
.sp
@ -2171,6 +2167,13 @@ numbering the capturing subpatterns in the whole pattern. However, substring
capturing is carried out only for positive assertions. (Perl sometimes, but not
always, does do capturing in negative assertions.)
.P
WARNING: If a positive assertion containing one or more capturing subpatterns
succeeds, but failure to match later in the pattern causes backtracking over
this assertion, the captures within the assertion are reset only if no higher
numbered captures are already set. This is, unfortunately, a fundamental
limitation of the current implementation, and as PCRE1 is now in
maintenance-only status, it is unlikely ever to change.
.P
For compatibility with Perl, assertion subpatterns may be repeated; though
it makes no sense to assert the same thing several times, the side effect of
capturing parentheses may occasionally be useful. In practice, there only three
@ -3296,6 +3299,6 @@ Cambridge CB2 3QH, England.
.rs
.sp
.nf
Last updated: 14 June 2015
Copyright (c) 1997-2015 University of Cambridge.
Last updated: 23 October 2016
Copyright (c) 1997-2016 University of Cambridge.
.fi

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