Commit 1ce57e88 authored by istruewing@stella.local's avatar istruewing@stella.local

Merge stella.local:/home2/mydev/mysql-5.1-amain

into  stella.local:/home2/mydev/mysql-5.1-axmrg
parents abfb0e4a 9f3784d2
This diff is collapsed.
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
# #
# Check cpu of current machine and find the # Check cpu of current machine and find the
# best compiler optimization flags for gcc # best compiler optimization flags for gcc
# Will return result in:
# cpu_arg : Type of CPU
# check_cpu_args : Arguments for GCC compiler settings
# #
check_cpu () { check_cpu () {
...@@ -33,7 +36,7 @@ check_cpu () { ...@@ -33,7 +36,7 @@ check_cpu () {
# parse CPU flags # parse CPU flags
for flag in `$cpuinfo | grep '^flags' | sed -e 's/^flags.*: //' -e 's/[^a-zA-Z0-9_ ]/_/g'`; do for flag in `$cpuinfo | grep '^flags' | sed -e 's/^flags.*: //' -e 's/[^a-zA-Z0-9_ ]/_/g'`; do
eval cpu_flag_$flag=yes eval cpu_flag_$flag=yes
done done
else else
# Fallback when there is no /proc/cpuinfo # Fallback when there is no /proc/cpuinfo
...@@ -62,92 +65,95 @@ check_cpu () { ...@@ -62,92 +65,95 @@ check_cpu () {
Alpha*EV6*) Alpha*EV6*)
cpu_arg="ev6"; cpu_arg="ev6";
;; ;;
# Intel ia32 # Intel ia32
*Intel*Core*|*X[eE][oO][nN]*) *Intel*Core*|*X[eE][oO][nN]*)
# a Xeon is just another pentium4 ... # a Xeon is just another pentium4 ...
# ... unless it has the "lm" (long-mode) flag set, # ... unless it has the "lm" (long-mode) flag set,
# in that case it's a Xeon with EM64T support # in that case it's a Xeon with EM64T support
# If SSE3 support exists it is a Core2 Duo or newer
# So is Intel Core. # So is Intel Core.
if [ -z "$cpu_flag_lm" ]; then if [ -z "$cpu_flag_lm" ]; then
cpu_arg="pentium4"; cpu_arg="pentium4"
else else
cpu_arg="nocona"; cpu_arg="nocona"
fi
if test -z "$cpu_flag_ssse3" ; then
core2="no"
else
core2="yes"
fi fi
;; ;;
*Pentium*4*Mobile*) *Pentium*4*Mobile*)
cpu_arg="pentium4m"; cpu_arg="pentium4m"
;; ;;
*Pentium*4*) *Pentium*4*)
cpu_arg="pentium4"; cpu_arg="pentium4"
;; ;;
*Pentium*III*Mobile*) *Pentium*III*Mobile*)
cpu_arg="pentium3m"; cpu_arg="pentium3m"
;; ;;
*Pentium*III*) *Pentium*III*)
cpu_arg="pentium3"; cpu_arg="pentium3"
;; ;;
*Pentium*M*pro*) *Pentium*M*pro*)
cpu_arg="pentium-m"; cpu_arg="pentium-m"
;; ;;
*Celeron\(R\)*\ M*) *Celeron\(R\)*\ M*)
cpu_arg="pentium-m"; cpu_arg="pentium-m"
;; ;;
*Celeron*Coppermine*) *Celeron*Coppermine*)
cpu_arg="pentium3" cpu_arg="pentium3"
;; ;;
*Celeron\(R\)*) *Celeron\(R\)*)
cpu_arg="pentium4" cpu_arg="pentium4"
;; ;;
*Celeron*) *Celeron*)
cpu_arg="pentium2"; cpu_arg="pentium2"
;;
*Athlon*64*)
cpu_arg="athlon64";
;; ;;
*Turion*) *Turion*)
cpu_arg="athlon64"; cpu_arg="athlon64"
;; ;;
*Opteron*) *Athlon*64*)
cpu_arg="athlon64"; cpu_arg="athlon64"
;; ;;
*Athlon*) *Athlon*)
cpu_arg="athlon"; cpu_arg="athlon"
;; ;;
*Opteron*) *Opteron*)
cpu_arg="opteron"; cpu_arg="opteron"
;; ;;
# MacOSX / Intel # MacOSX / Intel
*i386*i486*) *i386*i486*)
cpu_arg="pentium-m"; cpu_arg="pentium-m"
;;
*i386*)
cpu_arg="i386"
;; ;;
#Core 2 Duo #Core 2 Duo
*Intel*Core\(TM\)2*) *Intel*Core\(TM\)2*)
cpu_arg="nocona"; cpu_arg="nocona"
;; ;;
# Intel ia64 # Intel ia64
*Itanium*) *Itanium*)
# Don't need to set any flags for itanium(at the moment) cpu_arg="itanium"
cpu_arg="";
;; ;;
# Solaris Sparc
# *sparc*sun4u*)
cpu_arg="sparc"
;;
# Power PC
*ppc*) *ppc*)
cpu_arg='powerpc' cpu_arg="powerpc"
;; ;;
*powerpc*) *powerpc*)
cpu_arg='powerpc' cpu_arg="powerpc"
;; ;;
# unknown # unknown
*) *)
cpu_arg=""; cpu_arg=""
;; ;;
esac esac
if test -z "$cpu_arg" ; then if test -z "$cpu_arg" ; then
if test "$CPUINFO" != " " ; then if test "$CPUINFO" != " " ; then
# fallback to uname if necessary # fallback to uname if necessary
...@@ -176,29 +182,22 @@ check_cpu () { ...@@ -176,29 +182,22 @@ check_cpu () {
cc_minor=$2 cc_minor=$2
cc_patch=$3 cc_patch=$3
cc_comp=`expr $cc_major '*' 100 '+' $cc_minor` cc_comp=`expr $cc_major '*' 100 '+' $cc_minor`
case "$cc_ver--$cc_verno" in case "$cc_ver--$cc_verno" in
*GCC*) *GCC*)
# different gcc backends (and versions) have different CPU flags # different gcc backends (and versions) have different CPU flags
case `gcc -dumpmachine` in case `gcc -dumpmachine` in
i?86-*) i?86-* | x86_64-*)
if test "$cc_comp" -lt 304 if test "$cc_comp" -lt 304 ; then
then check_cpu_cflags="-mcpu=${cpu_arg}"
check_cpu_args='-mcpu=$cpu_arg' elif test "$cc_comp" -ge 402 ; then
check_cpu_cflags="-mtune=native"
else else
check_cpu_args='-mtune=$cpu_arg' check_cpu_cflags="-mtune=${cpu_arg}"
fi fi
;; ;;
ppc-*) ppc-*)
check_cpu_args='-mcpu=$cpu_arg -mtune=$cpu_arg' check_cpu_cflags="-mcpu=${cpu_arg} -mtune=${cpu_arg}"
;;
x86_64-*)
if test "$cc_comp" -lt 304
then
check_cpu_args='-mcpu=$cpu_arg'
else
check_cpu_args='-mtune=$cpu_arg'
fi
;; ;;
*) *)
check_cpu_cflags="" check_cpu_cflags=""
...@@ -208,7 +207,7 @@ check_cpu () { ...@@ -208,7 +207,7 @@ check_cpu () {
;; ;;
2.95.*) 2.95.*)
# GCC 2.95 doesn't expose its name in --version output # GCC 2.95 doesn't expose its name in --version output
check_cpu_args='-m$cpu_arg' check_cpu_cflags="-m${cpu_arg}"
;; ;;
*) *)
check_cpu_cflags="" check_cpu_cflags=""
...@@ -219,41 +218,23 @@ check_cpu () { ...@@ -219,41 +218,23 @@ check_cpu () {
# now we check whether the compiler really understands the cpu type # now we check whether the compiler really understands the cpu type
touch __test.c touch __test.c
if test "x$core2" = "xyes" ; then
cpu_arg="core2"
fi
while [ "$cpu_arg" ] ; do while [ "$cpu_arg" ] ; do
printf "testing $cpu_arg ... " >&2 printf "testing $cpu_arg ... " >&2
# compile check # compile check
check_cpu_cflags=`eval echo $check_cpu_args` eval "$cc -c $check_cpu_cflags __test.c" 2>/dev/null
if $cc -c $check_cpu_cflags __test.c 2>/dev/null; then if test "x$?" = "x0" ; then
echo ok >&2 echo ok >&2
break; break;
fi fi
echo failed >&2 echo failed >&2
check_cpu_cflags="" check_cpu_cflags=""
break;
# if compile failed: check whether it supports a predecessor of this CPU
# this list is not complete, feel free to add further entries
case "$cpu_arg" in
# Intel ia32
nocona) cpu_arg=pentium4 ;;
prescott) cpu_arg=pentium4 ;;
pentium4m) cpu_arg=pentium4 ;;
pentium4) cpu_arg=pentium3 ;;
pentium3m) cpu_arg=pentium3 ;;
pentium3) cpu_arg=pentium2 ;;
pentium2) cpu_arg=pentiumpro ;;
pentiumpro) cpu_arg=pentium ;;
pentium) cpu_arg=i486 ;;
i486) cpu_arg=i386 ;;
# power / powerPC
7450) cpu_arg=7400 ;;
*) cpu_arg="" ;;
esac
done done
rm __test.* rm __test.*
} }
......
...@@ -136,6 +136,8 @@ struct editline { ...@@ -136,6 +136,8 @@ struct editline {
protected int el_editmode(EditLine *, int, const char **); protected int el_editmode(EditLine *, int, const char **);
#define el_isprint(x) ((unsigned char) (x) < 0x80 ? isprint(x) : 1)
#ifdef DEBUG #ifdef DEBUG
#define EL_ABORT(a) do { \ #define EL_ABORT(a) do { \
fprintf(el->el_errfile, "%s, %d: ", \ fprintf(el->el_errfile, "%s, %d: ", \
......
...@@ -618,7 +618,7 @@ key__decode_char(char *buf, int cnt, int ch) ...@@ -618,7 +618,7 @@ key__decode_char(char *buf, int cnt, int ch)
} else if (ch == '\\') { } else if (ch == '\\') {
buf[cnt++] = '\\'; buf[cnt++] = '\\';
buf[cnt] = '\\'; buf[cnt] = '\\';
} else if (ch == ' ' || (isprint(ch) && !isspace(ch))) { } else if (ch == ' ' || (el_isprint(ch) && !isspace(ch))) {
buf[cnt] = ch; buf[cnt] = ch;
} else { } else {
buf[cnt++] = '\\'; buf[cnt++] = '\\';
...@@ -660,7 +660,7 @@ key__decode_str(const char *str, char *buf, const char *sep) ...@@ -660,7 +660,7 @@ key__decode_str(const char *str, char *buf, const char *sep)
} else if (*p == '^' || *p == '\\') { } else if (*p == '^' || *p == '\\') {
*b++ = '\\'; *b++ = '\\';
*b++ = *p; *b++ = *p;
} else if (*p == ' ' || (isprint((unsigned char) *p) && } else if (*p == ' ' || (el_isprint((unsigned char) *p) &&
!isspace((unsigned char) *p))) { !isspace((unsigned char) *p))) {
*b++ = *p; *b++ = *p;
} else { } else {
......
...@@ -961,7 +961,7 @@ map_init_nls(EditLine *el) ...@@ -961,7 +961,7 @@ map_init_nls(EditLine *el)
el_action_t *map = el->el_map.key; el_action_t *map = el->el_map.key;
for (i = 0200; i <= 0377; i++) for (i = 0200; i <= 0377; i++)
if (isprint(i)) if (el_isprint(i))
map[i] = ED_INSERT; map[i] = ED_INSERT;
} }
......
...@@ -508,7 +508,7 @@ el_gets(EditLine *el, int *nread) ...@@ -508,7 +508,7 @@ el_gets(EditLine *el, int *nread)
el->el_chared.c_redo.pos < el->el_chared.c_redo.lim) { el->el_chared.c_redo.pos < el->el_chared.c_redo.lim) {
if (cmdnum == VI_DELETE_PREV_CHAR && if (cmdnum == VI_DELETE_PREV_CHAR &&
el->el_chared.c_redo.pos != el->el_chared.c_redo.buf el->el_chared.c_redo.pos != el->el_chared.c_redo.buf
&& isprint((unsigned char)el->el_chared.c_redo.pos[-1])) && el_isprint((unsigned char)el->el_chared.c_redo.pos[-1]))
el->el_chared.c_redo.pos--; el->el_chared.c_redo.pos--;
else else
*el->el_chared.c_redo.pos++ = ch; *el->el_chared.c_redo.pos++ = ch;
......
...@@ -88,7 +88,7 @@ private void ...@@ -88,7 +88,7 @@ private void
re_addc(EditLine *el, int c) re_addc(EditLine *el, int c)
{ {
if (isprint(c)) { if (el_isprint(c)) {
re_putc(el, c, 1); re_putc(el, c, 1);
return; return;
} }
...@@ -964,7 +964,7 @@ re_refresh_cursor(EditLine *el) ...@@ -964,7 +964,7 @@ re_refresh_cursor(EditLine *el)
h = 1; h = 1;
v++; v++;
} }
} else if (!isprint((unsigned char) c)) { } else if (!el_isprint((unsigned char) c)) {
h += 3; h += 3;
if (h > th) { /* if overflow, compensate */ if (h > th) { /* if overflow, compensate */
h = h - th; h = h - th;
...@@ -1057,7 +1057,7 @@ re_fastaddc(EditLine *el) ...@@ -1057,7 +1057,7 @@ re_fastaddc(EditLine *el)
char mc = (c == '\177') ? '?' : (c | 0100); char mc = (c == '\177') ? '?' : (c | 0100);
re_fastputc(el, '^'); re_fastputc(el, '^');
re_fastputc(el, mc); re_fastputc(el, mc);
} else if (isprint((unsigned char) c)) { /* normal char */ } else if (el_isprint((unsigned char) c)) { /* normal char */
re_fastputc(el, c); re_fastputc(el, c);
} else { } else {
re_fastputc(el, '\\'); re_fastputc(el, '\\');
......
...@@ -187,7 +187,7 @@ typedef int (*mysql_var_check_func)(MYSQL_THD thd, ...@@ -187,7 +187,7 @@ typedef int (*mysql_var_check_func)(MYSQL_THD thd,
*/ */
typedef void (*mysql_var_update_func)(MYSQL_THD thd, typedef void (*mysql_var_update_func)(MYSQL_THD thd,
struct st_mysql_sys_var *var, struct st_mysql_sys_var *var,
void *var_ptr, void *save); void *var_ptr, const void *save);
/* the following declarations are for internal use only */ /* the following declarations are for internal use only */
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
SET @safe_character_set_server= @@character_set_server; SET @safe_character_set_server= @@character_set_server;
SET @safe_collation_server= @@collation_server; SET @safe_collation_server= @@collation_server;
SET @safe_character_set_client= @@character_set_client;
SET @safe_character_set_results= @@character_set_results;
SET character_set_server= @test_character_set; SET character_set_server= @test_character_set;
SET collation_server= @test_collation; SET collation_server= @test_collation;
CREATE DATABASE d1; CREATE DATABASE d1;
...@@ -62,8 +64,22 @@ select a sounds like a from t1; ...@@ -62,8 +64,22 @@ select a sounds like a from t1;
select 1 from t1 order by cast(a as char(1)); select 1 from t1 order by cast(a as char(1));
drop table t1; drop table t1;
#
# Bug#27580 SPACE() function collation bug?
#
set names utf8;
create table t1 (
name varchar(10),
level smallint unsigned);
show create table t1;
insert into t1 values ('string',1);
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
drop table t1;
DROP DATABASE d1; DROP DATABASE d1;
# Restore settings # Restore settings
USE test; USE test;
SET character_set_server= @safe_character_set_server; SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server; SET collation_server= @safe_collation_server;
SET character_set_client= @safe_character_set_client;
SET character_set_results= @safe_character_set_results;
...@@ -9,7 +9,10 @@ ...@@ -9,7 +9,10 @@
# sql threads to stop # sql threads to stop
# 3) If loops too long die. # 3) If loops too long die.
#################################################### ####################################################
connection slave; if (!$keep_connection)
{
connection slave;
}
let $row_number= 1; let $row_number= 1;
let $run= 1; let $run= 1;
let $counter= 300; let $counter= 300;
......
...@@ -279,6 +279,8 @@ sub mtr_report_stats ($) { ...@@ -279,6 +279,8 @@ sub mtr_report_stats ($) {
/Failed to open log/ or /Failed to open log/ or
/Failed to open the existing master info file/ or /Failed to open the existing master info file/ or
/Forcing shutdown of [0-9]* plugins/ or /Forcing shutdown of [0-9]* plugins/ or
/Can't open shared library .*\bha_example\b/ or
/Couldn't load plugin .*\bha_example\b/ or
# Due to timing issues, it might be that this warning # Due to timing issues, it might be that this warning
# is printed when the server shuts down and the # is printed when the server shuts down and the
......
...@@ -5379,4 +5379,13 @@ SHOW WARNINGS; ...@@ -5379,4 +5379,13 @@ SHOW WARNINGS;
Level Code Message Level Code Message
Error 1178 The storage engine for the table doesn't support nullable columns Error 1178 The storage engine for the table doesn't support nullable columns
Error 1005 Can't create table 'test.t1' (errno: 138) Error 1005 Can't create table 'test.t1' (errno: 138)
create table t1 (c1 tinyblob not null) engine=csv;
insert into t1 values("This");
update t1 set c1="That" where c1="This";
affected rows: 1
info: Rows matched: 1 Changed: 1 Warnings: 0
select * from t1;
c1
That
drop table t1;
End of 5.1 tests End of 5.1 tests
...@@ -3,6 +3,8 @@ SET @test_character_set= 'big5'; ...@@ -3,6 +3,8 @@ SET @test_character_set= 'big5';
SET @test_collation= 'big5_chinese_ci'; SET @test_collation= 'big5_chinese_ci';
SET @safe_character_set_server= @@character_set_server; SET @safe_character_set_server= @@character_set_server;
SET @safe_collation_server= @@collation_server; SET @safe_collation_server= @@collation_server;
SET @safe_character_set_client= @@character_set_client;
SET @safe_character_set_results= @@character_set_results;
SET character_set_server= @test_character_set; SET character_set_server= @test_character_set;
SET collation_server= @test_collation; SET collation_server= @test_collation;
CREATE DATABASE d1; CREATE DATABASE d1;
...@@ -69,10 +71,27 @@ select 1 from t1 order by cast(a as char(1)); ...@@ -69,10 +71,27 @@ select 1 from t1 order by cast(a as char(1));
1 1
1 1
drop table t1; drop table t1;
set names utf8;
create table t1 (
name varchar(10),
level smallint unsigned);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`name` varchar(10) default NULL,
`level` smallint(5) unsigned default NULL
) ENGINE=MyISAM DEFAULT CHARSET=big5
insert into t1 values ('string',1);
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
concat(name,space(level)) concat(name, repeat(' ',level))
string string
drop table t1;
DROP DATABASE d1; DROP DATABASE d1;
USE test; USE test;
SET character_set_server= @safe_character_set_server; SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server; SET collation_server= @safe_collation_server;
SET character_set_client= @safe_character_set_client;
SET character_set_results= @safe_character_set_results;
SET NAMES big5; SET NAMES big5;
SET collation_connection='big5_chinese_ci'; SET collation_connection='big5_chinese_ci';
create table t1 select repeat('a',4000) a; create table t1 select repeat('a',4000) a;
......
...@@ -3,6 +3,192 @@ DROP TABLE IF EXISTS t1; ...@@ -3,6 +3,192 @@ DROP TABLE IF EXISTS t1;
SHOW COLLATION LIKE 'cp1250_czech_cs'; SHOW COLLATION LIKE 'cp1250_czech_cs';
Collation Charset Id Default Compiled Sortlen Collation Charset Id Default Compiled Sortlen
cp1250_czech_cs cp1250 34 Yes 2 cp1250_czech_cs cp1250 34 Yes 2
SET @test_character_set= 'cp1250';
SET @test_collation= 'cp1250_general_ci';
SET @safe_character_set_server= @@character_set_server;
SET @safe_collation_server= @@collation_server;
SET @safe_character_set_client= @@character_set_client;
SET @safe_character_set_results= @@character_set_results;
SET character_set_server= @test_character_set;
SET collation_server= @test_collation;
CREATE DATABASE d1;
USE d1;
CREATE TABLE t1 (c CHAR(10), KEY(c));
SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment
c char(10) cp1250_general_ci YES MUL NULL
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
want3results
aaa
aaaa
aaaaa
DROP TABLE t1;
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment
c1 varchar(15) cp1250_general_ci YES MUL NULL
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
SELECT c1 as want3results from t1 where c1 like 'l%';
want3results
location
loberge
lotre
SELECT c1 as want3results from t1 where c1 like 'lo%';
want3results
location
loberge
lotre
SELECT c1 as want1result from t1 where c1 like 'loc%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'loca%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locat%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locati%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locatio%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'location%';
want1result
location
DROP TABLE t1;
create table t1 (a set('a') not null);
insert into t1 values (),();
Warnings:
Warning 1364 Field 'a' doesn't have a default value
select cast(a as char(1)) from t1;
cast(a as char(1))
select a sounds like a from t1;
a sounds like a
1
1
select 1 from t1 order by cast(a as char(1));
1
1
1
drop table t1;
set names utf8;
create table t1 (
name varchar(10),
level smallint unsigned);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`name` varchar(10) DEFAULT NULL,
`level` smallint(5) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=cp1250
insert into t1 values ('string',1);
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
concat(name,space(level)) concat(name, repeat(' ',level))
string string
drop table t1;
DROP DATABASE d1;
USE test;
SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server;
SET character_set_client= @safe_character_set_client;
SET character_set_results= @safe_character_set_results;
SET @test_character_set= 'cp1250';
SET @test_collation= 'cp1250_czech_cs';
SET @safe_character_set_server= @@character_set_server;
SET @safe_collation_server= @@collation_server;
SET @safe_character_set_client= @@character_set_client;
SET @safe_character_set_results= @@character_set_results;
SET character_set_server= @test_character_set;
SET collation_server= @test_collation;
CREATE DATABASE d1;
USE d1;
CREATE TABLE t1 (c CHAR(10), KEY(c));
SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment
c char(10) cp1250_czech_cs YES MUL NULL
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
want3results
aaa
aaaa
aaaaa
DROP TABLE t1;
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment
c1 varchar(15) cp1250_czech_cs YES MUL NULL
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
SELECT c1 as want3results from t1 where c1 like 'l%';
want3results
location
loberge
lotre
SELECT c1 as want3results from t1 where c1 like 'lo%';
want3results
location
loberge
lotre
SELECT c1 as want1result from t1 where c1 like 'loc%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'loca%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locat%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locati%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locatio%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'location%';
want1result
location
DROP TABLE t1;
create table t1 (a set('a') not null);
insert into t1 values (),();
Warnings:
Warning 1364 Field 'a' doesn't have a default value
select cast(a as char(1)) from t1;
cast(a as char(1))
select a sounds like a from t1;
a sounds like a
1
1
select 1 from t1 order by cast(a as char(1));
1
1
1
drop table t1;
set names utf8;
create table t1 (
name varchar(10),
level smallint unsigned);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`name` varchar(10) COLLATE cp1250_czech_cs DEFAULT NULL,
`level` smallint(5) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=cp1250 COLLATE=cp1250_czech_cs
insert into t1 values ('string',1);
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
concat(name,space(level)) concat(name, repeat(' ',level))
string string
drop table t1;
DROP DATABASE d1;
USE test;
SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server;
SET character_set_client= @safe_character_set_client;
SET character_set_results= @safe_character_set_results;
CREATE TABLE t1 (a char(16)) character set cp1250 collate cp1250_czech_cs; CREATE TABLE t1 (a char(16)) character set cp1250 collate cp1250_czech_cs;
INSERT INTO t1 VALUES (''); INSERT INTO t1 VALUES ('');
SELECT a, length(a), a='', a=' ', a=' ' FROM t1; SELECT a, length(a), a='', a=' ', a=' ' FROM t1;
......
...@@ -3,6 +3,8 @@ SET @test_character_set= 'euckr'; ...@@ -3,6 +3,8 @@ SET @test_character_set= 'euckr';
SET @test_collation= 'euckr_korean_ci'; SET @test_collation= 'euckr_korean_ci';
SET @safe_character_set_server= @@character_set_server; SET @safe_character_set_server= @@character_set_server;
SET @safe_collation_server= @@collation_server; SET @safe_collation_server= @@collation_server;
SET @safe_character_set_client= @@character_set_client;
SET @safe_character_set_results= @@character_set_results;
SET character_set_server= @test_character_set; SET character_set_server= @test_character_set;
SET collation_server= @test_collation; SET collation_server= @test_collation;
CREATE DATABASE d1; CREATE DATABASE d1;
...@@ -69,10 +71,27 @@ select 1 from t1 order by cast(a as char(1)); ...@@ -69,10 +71,27 @@ select 1 from t1 order by cast(a as char(1));
1 1
1 1
drop table t1; drop table t1;
set names utf8;
create table t1 (
name varchar(10),
level smallint unsigned);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`name` varchar(10) DEFAULT NULL,
`level` smallint(5) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=euckr
insert into t1 values ('string',1);
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
concat(name,space(level)) concat(name, repeat(' ',level))
string string
drop table t1;
DROP DATABASE d1; DROP DATABASE d1;
USE test; USE test;
SET character_set_server= @safe_character_set_server; SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server; SET collation_server= @safe_collation_server;
SET character_set_client= @safe_character_set_client;
SET character_set_results= @safe_character_set_results;
SET NAMES euckr; SET NAMES euckr;
SET collation_connection='euckr_korean_ci'; SET collation_connection='euckr_korean_ci';
create table t1 select repeat('a',4000) a; create table t1 select repeat('a',4000) a;
......
...@@ -3,6 +3,8 @@ SET @test_character_set= 'gb2312'; ...@@ -3,6 +3,8 @@ SET @test_character_set= 'gb2312';
SET @test_collation= 'gb2312_chinese_ci'; SET @test_collation= 'gb2312_chinese_ci';
SET @safe_character_set_server= @@character_set_server; SET @safe_character_set_server= @@character_set_server;
SET @safe_collation_server= @@collation_server; SET @safe_collation_server= @@collation_server;
SET @safe_character_set_client= @@character_set_client;
SET @safe_character_set_results= @@character_set_results;
SET character_set_server= @test_character_set; SET character_set_server= @test_character_set;
SET collation_server= @test_collation; SET collation_server= @test_collation;
CREATE DATABASE d1; CREATE DATABASE d1;
...@@ -69,10 +71,27 @@ select 1 from t1 order by cast(a as char(1)); ...@@ -69,10 +71,27 @@ select 1 from t1 order by cast(a as char(1));
1 1
1 1
drop table t1; drop table t1;
set names utf8;
create table t1 (
name varchar(10),
level smallint unsigned);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`name` varchar(10) DEFAULT NULL,
`level` smallint(5) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=gb2312
insert into t1 values ('string',1);
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
concat(name,space(level)) concat(name, repeat(' ',level))
string string
drop table t1;
DROP DATABASE d1; DROP DATABASE d1;
USE test; USE test;
SET character_set_server= @safe_character_set_server; SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server; SET collation_server= @safe_collation_server;
SET character_set_client= @safe_character_set_client;
SET character_set_results= @safe_character_set_results;
SET NAMES gb2312; SET NAMES gb2312;
SET collation_connection='gb2312_chinese_ci'; SET collation_connection='gb2312_chinese_ci';
create table t1 select repeat('a',4000) a; create table t1 select repeat('a',4000) a;
......
...@@ -3,6 +3,8 @@ SET @test_character_set= 'gbk'; ...@@ -3,6 +3,8 @@ SET @test_character_set= 'gbk';
SET @test_collation= 'gbk_chinese_ci'; SET @test_collation= 'gbk_chinese_ci';
SET @safe_character_set_server= @@character_set_server; SET @safe_character_set_server= @@character_set_server;
SET @safe_collation_server= @@collation_server; SET @safe_collation_server= @@collation_server;
SET @safe_character_set_client= @@character_set_client;
SET @safe_character_set_results= @@character_set_results;
SET character_set_server= @test_character_set; SET character_set_server= @test_character_set;
SET collation_server= @test_collation; SET collation_server= @test_collation;
CREATE DATABASE d1; CREATE DATABASE d1;
...@@ -69,10 +71,27 @@ select 1 from t1 order by cast(a as char(1)); ...@@ -69,10 +71,27 @@ select 1 from t1 order by cast(a as char(1));
1 1
1 1
drop table t1; drop table t1;
set names utf8;
create table t1 (
name varchar(10),
level smallint unsigned);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`name` varchar(10) DEFAULT NULL,
`level` smallint(5) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=gbk
insert into t1 values ('string',1);
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
concat(name,space(level)) concat(name, repeat(' ',level))
string string
drop table t1;
DROP DATABASE d1; DROP DATABASE d1;
USE test; USE test;
SET character_set_server= @safe_character_set_server; SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server; SET collation_server= @safe_collation_server;
SET character_set_client= @safe_character_set_client;
SET character_set_results= @safe_character_set_results;
SET NAMES gbk; SET NAMES gbk;
SET collation_connection='gbk_chinese_ci'; SET collation_connection='gbk_chinese_ci';
create table t1 select repeat('a',4000) a; create table t1 select repeat('a',4000) a;
......
...@@ -2538,6 +2538,8 @@ SET @test_character_set= 'utf8'; ...@@ -2538,6 +2538,8 @@ SET @test_character_set= 'utf8';
SET @test_collation= 'utf8_swedish_ci'; SET @test_collation= 'utf8_swedish_ci';
SET @safe_character_set_server= @@character_set_server; SET @safe_character_set_server= @@character_set_server;
SET @safe_collation_server= @@collation_server; SET @safe_collation_server= @@collation_server;
SET @safe_character_set_client= @@character_set_client;
SET @safe_character_set_results= @@character_set_results;
SET character_set_server= @test_character_set; SET character_set_server= @test_character_set;
SET collation_server= @test_collation; SET collation_server= @test_collation;
CREATE DATABASE d1; CREATE DATABASE d1;
...@@ -2604,10 +2606,27 @@ select 1 from t1 order by cast(a as char(1)); ...@@ -2604,10 +2606,27 @@ select 1 from t1 order by cast(a as char(1));
1 1
1 1
drop table t1; drop table t1;
set names utf8;
create table t1 (
name varchar(10),
level smallint unsigned);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`name` varchar(10) COLLATE utf8_swedish_ci DEFAULT NULL,
`level` smallint(5) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_swedish_ci
insert into t1 values ('string',1);
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
concat(name,space(level)) concat(name, repeat(' ',level))
string string
drop table t1;
DROP DATABASE d1; DROP DATABASE d1;
USE test; USE test;
SET character_set_server= @safe_character_set_server; SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server; SET collation_server= @safe_collation_server;
SET character_set_client= @safe_character_set_client;
SET character_set_results= @safe_character_set_results;
create table t1 (a varchar(1)) character set utf8 collate utf8_estonian_ci; create table t1 (a varchar(1)) character set utf8 collate utf8_estonian_ci;
insert into t1 values ('A'),('B'),('C'),('a'),('b'),('c'); insert into t1 values ('A'),('B'),('C'),('a'),('b'),('c');
select a, a regexp '[a]' from t1 order by binary a; select a, a regexp '[a]' from t1 order by binary a;
......
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
SET @test_character_set= 'ucs2';
SET @test_collation= 'ucs2_general_ci';
SET @safe_character_set_server= @@character_set_server;
SET @safe_collation_server= @@collation_server;
SET @safe_character_set_client= @@character_set_client;
SET @safe_character_set_results= @@character_set_results;
SET character_set_server= @test_character_set;
SET collation_server= @test_collation;
CREATE DATABASE d1;
USE d1;
CREATE TABLE t1 (c CHAR(10), KEY(c));
SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment
c char(10) ucs2_general_ci YES MUL NULL
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
want3results
aaa
aaaa
aaaaa
DROP TABLE t1;
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment
c1 varchar(15) ucs2_general_ci YES MUL NULL
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
SELECT c1 as want3results from t1 where c1 like 'l%';
want3results
location
loberge
lotre
SELECT c1 as want3results from t1 where c1 like 'lo%';
want3results
location
loberge
lotre
SELECT c1 as want1result from t1 where c1 like 'loc%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'loca%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locat%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locati%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locatio%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'location%';
want1result
location
DROP TABLE t1;
create table t1 (a set('a') not null);
insert into t1 values (),();
Warnings:
Warning 1364 Field 'a' doesn't have a default value
select cast(a as char(1)) from t1;
cast(a as char(1))
select a sounds like a from t1;
a sounds like a
1
1
select 1 from t1 order by cast(a as char(1));
1
1
1
drop table t1;
set names utf8;
create table t1 (
name varchar(10),
level smallint unsigned);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`name` varchar(10) DEFAULT NULL,
`level` smallint(5) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=ucs2
insert into t1 values ('string',1);
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
concat(name,space(level)) concat(name, repeat(' ',level))
string string
drop table t1;
DROP DATABASE d1;
USE test;
SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server;
SET character_set_client= @safe_character_set_client;
SET character_set_results= @safe_character_set_results;
SET NAMES latin1; SET NAMES latin1;
SET character_set_connection=ucs2; SET character_set_connection=ucs2;
select 'a' = 'a', 'a' = 'a ', 'a ' = 'a'; select 'a' = 'a', 'a' = 'a ', 'a ' = 'a';
......
...@@ -21,4 +21,14 @@ INSERT INTO t1 VALUES('A', 'A'), ('B', 'B'), ('C', 'C'); ...@@ -21,4 +21,14 @@ INSERT INTO t1 VALUES('A', 'A'), ('B', 'B'), ('C', 'C');
INSERT INTO t1 VALUES('A ', 'A '); INSERT INTO t1 VALUES('A ', 'A ');
ERROR 23000: Duplicate entry '' for key 'key1' ERROR 23000: Duplicate entry '' for key 'key1'
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (
c1 CHAR(255) CHARACTER SET UCS2 COLLATE UCS2_BIN NOT NULL,
KEY(c1)
) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('marshall\'s');
INSERT INTO t1 VALUES ('marsh');
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
End of 5.0 tests End of 5.0 tests
...@@ -2066,6 +2066,34 @@ select 1 from t1 order by a; ...@@ -2066,6 +2066,34 @@ select 1 from t1 order by a;
drop table t1; drop table t1;
drop table t1; drop table t1;
drop view v1; drop view v1;
CREATE TABLE t1 (a INT, b INT, KEY(a,b));
INSERT INTO t1 VALUES(NULL,1),(1,NULL),(NULL,NULL),(1,1),(2,2);
CREATE TABLE t1 (a INT, b INT, KEY(a,b)) ENGINE=federated
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1';
SELECT * FROM t1 WHERE a IS NULL;
a b
NULL NULL
NULL 1
SELECT * FROM t1 WHERE a IS NOT NULL;
a b
1 NULL
1 1
2 2
SELECT * FROM t1 WHERE a=1 AND b=1;
a b
1 1
SELECT * FROM t1 WHERE a IS NULL AND b=1;
a b
NULL 1
SELECT * FROM t1 WHERE a IS NOT NULL AND b=1;
a b
1 1
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (a INT) ENGINE=federated CONNECTION='mysql://@:://';
DROP TABLE t1;
create server 's1' foreign data wrapper 'mysql' options (port 3306);
drop server 's1';
End of 5.1 tests End of 5.1 tests
DROP TABLE IF EXISTS federated.t1; DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated; DROP DATABASE IF EXISTS federated;
......
...@@ -249,6 +249,9 @@ select min(a) from t1 group by inet_ntoa(a); ...@@ -249,6 +249,9 @@ select min(a) from t1 group by inet_ntoa(a);
min(a) min(a)
-2 -2
drop table t1; drop table t1;
SELECT NAME_CONST('var', 'value') COLLATE latin1_general_cs;
NAME_CONST('var', 'value') COLLATE latin1_general_cs
value
End of 5.0 tests End of 5.0 tests
select connection_id() > 0; select connection_id() > 0;
connection_id() > 0 connection_id() > 0
......
...@@ -1633,4 +1633,6 @@ show open tables where f1()=0; ...@@ -1633,4 +1633,6 @@ show open tables where f1()=0;
show open tables where f1()=0; show open tables where f1()=0;
drop table t1; drop table t1;
drop function f1; drop function f1;
select * from information_schema.tables where 1=sleep(100000);
select * from information_schema.columns where 1=sleep(100000);
End of 5.1 tests. End of 5.1 tests.
...@@ -107,6 +107,17 @@ Database Table In_use Name_locked ...@@ -107,6 +107,17 @@ Database Table In_use Name_locked
SET GLOBAL GENERAL_LOG=ON; SET GLOBAL GENERAL_LOG=ON;
SET GLOBAL SLOW_QUERY_LOG=ON; SET GLOBAL SLOW_QUERY_LOG=ON;
truncate table mysql.general_log; truncate table mysql.general_log;
set names binary;
select _koi8r'' as test;
test
select * from mysql.general_log;
event_time user_host thread_id server_id command_type argument
TIMESTAMP USER_HOST THREAD_ID 1 Query set names binary
TIMESTAMP USER_HOST THREAD_ID 1 Query select _koi8r'\xD4\xC5\xD3\xD4' as test
TIMESTAMP USER_HOST THREAD_ID 1 Query select * from mysql.general_log
set names utf8;
truncate table mysql.general_log;
set names utf8; set names utf8;
create table bug16905 (s char(15) character set utf8 default 'пусто'); create table bug16905 (s char(15) character set utf8 default 'пусто');
insert into bug16905 values ('новое'); insert into bug16905 values ('новое');
......
...@@ -24,54 +24,3 @@ UNLOCK TABLES; ...@@ -24,54 +24,3 @@ UNLOCK TABLES;
SET SESSION debug="-d,sleep_open_and_lock_after_open"; SET SESSION debug="-d,sleep_open_and_lock_after_open";
# connection default # connection default
DROP TABLE t1; DROP TABLE t1;
#
# Extra tests for Bug#26379 - Combination of FLUSH TABLE and
# REPAIR TABLE corrupts a MERGE table
#
CREATE TABLE t1 (c1 INT);
CREATE TABLE t2 (c1 INT);
CREATE TABLE t3 (c1 INT);
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2);
INSERT INTO t3 VALUES (3);
#
# CREATE ... SELECT
# try to access parent from another thread.
#
# connection con1
SET SESSION debug="+d,sleep_create_select_before_lock";
CREATE TABLE t4 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1,t2)
INSERT_METHOD=FIRST SELECT * FROM t3;
# connection default
# Now try to access the parent.
# If 3 is in table, SELECT had to wait.
SELECT * FROM t4 ORDER BY c1;
c1
1
2
3
# connection con1
SET SESSION debug="-d,sleep_create_select_before_lock";
# connection default
# Cleanup for next test.
DROP TABLE t4;
DELETE FROM t1 WHERE c1 != 1;
#
# CREATE ... SELECT
# try to access child from another thread.
#
# connection con1
SET SESSION debug="+d,sleep_create_select_before_lock";
CREATE TABLE t4 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1,t2)
INSERT_METHOD=FIRST SELECT * FROM t3;
# connection default
# Now try to access a child.
# If 3 is in table, SELECT had to wait.
SELECT * FROM t1 ORDER BY c1;
c1
1
3
# connection con1
SET SESSION debug="-d,sleep_create_select_before_lock";
# connection default
DROP TABLE t1, t2, t3, t4;
...@@ -964,6 +964,28 @@ id ref ...@@ -964,6 +964,28 @@ id ref
3 2 3 2
4 5 4 5
DROP TABLE t1, t2, t3; DROP TABLE t1, t2, t3;
CREATE TABLE t1(a INT);
CREATE TABLE m1(a INT) ENGINE=MERGE;
SHOW CREATE TABLE m1;
Table Create Table
m1 CREATE TABLE `m1` (
`a` int(11) DEFAULT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1
DROP TABLE m1;
CREATE TABLE m1(a INT) ENGINE=MERGE UNION=();
SHOW CREATE TABLE m1;
Table Create Table
m1 CREATE TABLE `m1` (
`a` int(11) DEFAULT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1
ALTER TABLE m1 UNION=(t1);
ALTER TABLE m1 UNION=();
SHOW CREATE TABLE m1;
Table Create Table
m1 CREATE TABLE `m1` (
`a` int(11) DEFAULT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1, m1;
End of 5.0 tests End of 5.0 tests
create table t1 (c1 int, index(c1)); create table t1 (c1 int, index(c1));
create table t2 (c1 int, index(c1)) engine=merge union=(t1); create table t2 (c1 int, index(c1)) engine=merge union=(t1);
...@@ -1129,7 +1151,7 @@ SHOW CREATE TABLE t4; ...@@ -1129,7 +1151,7 @@ SHOW CREATE TABLE t4;
Table Create Table Table Create Table
t4 CREATE TABLE `t4` ( t4 CREATE TABLE `t4` (
`c1` int(11) DEFAULT NULL `c1` int(11) DEFAULT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=() ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1
INSERT INTO t4 VALUES (4); INSERT INTO t4 VALUES (4);
ERROR HY000: Table 't4' is read only ERROR HY000: Table 't4' is read only
DROP TABLE t4; DROP TABLE t4;
...@@ -1146,7 +1168,7 @@ SHOW CREATE TABLE t4; ...@@ -1146,7 +1168,7 @@ SHOW CREATE TABLE t4;
Table Create Table Table Create Table
t4 CREATE TABLE `t4` ( t4 CREATE TABLE `t4` (
`c1` int(11) DEFAULT NULL `c1` int(11) DEFAULT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=() ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1
INSERT INTO t4 VALUES (4); INSERT INTO t4 VALUES (4);
ERROR HY000: Table 't4' is read only ERROR HY000: Table 't4' is read only
DROP TABLE t4; DROP TABLE t4;
......
...@@ -2024,4 +2024,185 @@ CHECK TABLE t1; ...@@ -2024,4 +2024,185 @@ CHECK TABLE t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (
c1 CHAR(130),
c2 VARCHAR(1)
) ENGINE=MyISAM;
INSERT INTO t1 VALUES(REPEAT("a",128), 'b');
SELECT COUNT(*) FROM t1;
COUNT(*)
1
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
REPAIR TABLE t1;
Table Op Msg_type Msg_text
test.t1 repair status OK
SELECT COUNT(*) FROM t1;
COUNT(*)
1
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
CREATE TABLE t1 (
c1 CHAR(130),
c2 VARCHAR(1)
) ENGINE=MyISAM;
INSERT INTO t1 VALUES(REPEAT("a",128), 'b');
SELECT COUNT(*) FROM t1;
COUNT(*)
1
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 repair status OK
SELECT COUNT(*) FROM t1;
COUNT(*)
1
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
CREATE TABLE t1 (
c1 CHAR(130),
c2 VARCHAR(1)
) ENGINE=MyISAM;
INSERT INTO t1 VALUES(REPEAT("a",128), 'b');
INSERT INTO t1 VALUES('b', 'b');
INSERT INTO t1 VALUES('c', 'b');
DELETE FROM t1 WHERE c1='b';
SELECT COUNT(*) FROM t1;
COUNT(*)
2
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
SELECT COUNT(*) FROM t1;
COUNT(*)
2
DROP TABLE t1;
CREATE TABLE t1 (
c1 CHAR(130),
c2 VARCHAR(1),
KEY (c1)
) ENGINE=MyISAM;
# Insert 100 rows. Query log disabled.
UPDATE t1 SET c1=REPEAT("a",128) LIMIT 90;
SELECT COUNT(*) FROM t1;
COUNT(*)
100
ALTER TABLE t1 ENGINE=MyISAM;
SELECT COUNT(*) FROM t1;
COUNT(*)
100
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
CREATE TABLE t1 (
c1 CHAR(50),
c2 VARCHAR(1)
) ENGINE=MyISAM DEFAULT CHARSET UTF8;
INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b');
SELECT COUNT(*) FROM t1;
COUNT(*)
1
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
REPAIR TABLE t1;
Table Op Msg_type Msg_text
test.t1 repair status OK
SELECT COUNT(*) FROM t1;
COUNT(*)
1
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
CREATE TABLE t1 (
c1 CHAR(50),
c2 VARCHAR(1)
) ENGINE=MyISAM DEFAULT CHARSET UTF8;
INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b');
SELECT COUNT(*) FROM t1;
COUNT(*)
1
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 repair status OK
SELECT COUNT(*) FROM t1;
COUNT(*)
1
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
CREATE TABLE t1 (
c1 CHAR(50),
c2 VARCHAR(1)
) ENGINE=MyISAM DEFAULT CHARSET UTF8;
INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b');
INSERT INTO t1 VALUES('b', 'b');
INSERT INTO t1 VALUES('c', 'b');
DELETE FROM t1 WHERE c1='b';
SELECT COUNT(*) FROM t1;
COUNT(*)
2
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
SELECT COUNT(*) FROM t1;
COUNT(*)
2
DROP TABLE t1;
CREATE TABLE t1 (
c1 CHAR(50),
c2 VARCHAR(1),
KEY (c1)
) ENGINE=MyISAM DEFAULT CHARSET UTF8;
# Insert 100 rows. Query log disabled.
UPDATE t1 SET c1=REPEAT(_utf8 x'e0ae85',43) LIMIT 90;
SELECT COUNT(*) FROM t1;
COUNT(*)
100
ALTER TABLE t1 ENGINE=MyISAM;
SELECT COUNT(*) FROM t1;
COUNT(*)
100
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
CREATE TABLE t1 (
c1 VARCHAR(10) NOT NULL,
c2 CHAR(10) DEFAULT NULL,
c3 VARCHAR(10) NOT NULL,
KEY (c1),
KEY (c2)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;
MyISAM file: MYSQLTEST_VARDIR/master-data/test/t1
Record format: Packed
Character set: utf8_general_ci (33)
Data records: 0 Deleted blocks: 0
Recordlength: 94
table description:
Key Start Len Index Type
1 2 30 multip. varchar
2 33 30 multip. char NULL
DROP TABLE t1;
End of 5.1 tests End of 5.1 tests
drop table if exists t1; drop table if exists t1;
create table t1 (a int) partition by list ((a/3)*10 div 1)
(partition p0 values in (0), partition p1 values in (1));
ERROR HY000: This partition function is not allowed
CREATE TABLE t1 ( CREATE TABLE t1 (
d DATE NOT NULL d DATE NOT NULL
) )
...@@ -44,15 +47,6 @@ partition by key(a) ...@@ -44,15 +47,6 @@ partition by key(a)
partitions 1e+300; partitions 1e+300;
ERROR 42000: Only integers allowed as number here near '1e+300' at line 3 ERROR 42000: Only integers allowed as number here near '1e+300' at line 3
create table t1 (a int) create table t1 (a int)
partition by key (a)
(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
ERROR 42000: Incorrect table name 'part-data'
create table t1 (a int)
partition by key (a)
(partition p0,
partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
ERROR 42000: Incorrect table name 'part-data'
create table t1 (a int)
partition by list (a) partition by list (a)
(partition p0 values in (1)); (partition p0 values in (1));
create procedure pz() create procedure pz()
...@@ -342,7 +336,7 @@ PARTITION BY LIST (a) ...@@ -342,7 +336,7 @@ PARTITION BY LIST (a)
(PARTITION x1 VALUES IN (10), PARTITION x2 VALUES IN (20)); (PARTITION x1 VALUES IN (10), PARTITION x2 VALUES IN (20));
analyze table t1; analyze table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 analyze status OK test.t1 analyze note The storage engine for the table doesn't support analyze
drop table t1; drop table t1;
create table t1 create table t1
(a int) (a int)
...@@ -536,11 +530,9 @@ t1 CREATE TABLE `t1` ( ...@@ -536,11 +530,9 @@ t1 CREATE TABLE `t1` (
alter table t1 alter table t1
partition by key(a) partition by key(a)
(partition p0, partition p1 engine=heap); (partition p0, partition p1 engine=heap);
ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL
alter table t1 alter table t1
partition by key(a) partition by key(a)
(partition p0 engine=heap, partition p1); (partition p0 engine=heap, partition p1);
ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL
alter table t1 alter table t1
engine=heap engine=heap
partition by key (a) partition by key (a)
...@@ -1045,9 +1037,7 @@ SHOW TABLE STATUS; ...@@ -1045,9 +1037,7 @@ SHOW TABLE STATUS;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 10 Fixed 1 14 14 0 0 7 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned t1 MyISAM 10 Fixed 1 14 14 0 0 7 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
ALTER TABLE t1 OPTIMIZE PARTITION p0; ALTER TABLE t1 OPTIMIZE PARTITION p0;
SHOW TABLE STATUS; ERROR 42000: The storage engine for the table doesn't support optimize partition
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 10 Fixed 1 7 7 0 1024 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a int, index(a)) PARTITION BY KEY(a); CREATE TABLE t1 (a int, index(a)) PARTITION BY KEY(a);
ALTER TABLE t1 DISABLE KEYS; ALTER TABLE t1 DISABLE KEYS;
...@@ -1062,6 +1052,12 @@ test.t1 repair note The storage engine for the table doesn't support repair ...@@ -1062,6 +1052,12 @@ test.t1 repair note The storage engine for the table doesn't support repair
OPTIMIZE TABLE t1; OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 optimize note The storage engine for the table doesn't support optimize test.t1 optimize note The storage engine for the table doesn't support optimize
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check note The storage engine for the table doesn't support check
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze note The storage engine for the table doesn't support analyze
drop table t1; drop table t1;
drop procedure if exists mysqltest_1; drop procedure if exists mysqltest_1;
create table t1 (a int) create table t1 (a int)
...@@ -1300,6 +1296,14 @@ ALTER TABLE t1 OPTIMIZE PARTITION p1 EXTENDED; ...@@ -1300,6 +1296,14 @@ ALTER TABLE t1 OPTIMIZE PARTITION p1 EXTENDED;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'EXTENDED' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'EXTENDED' at line 1
ALTER TABLE t1 ANALYZE PARTITION p1 EXTENDED; ALTER TABLE t1 ANALYZE PARTITION p1 EXTENDED;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'EXTENDED' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'EXTENDED' at line 1
ALTER TABLE t1 ANALYZE PARTITION p1;
ERROR 42000: The storage engine for the table doesn't support analyze partition
ALTER TABLE t1 CHECK PARTITION p1;
ERROR 42000: The storage engine for the table doesn't support check partition
ALTER TABLE t1 REPAIR PARTITION p1;
ERROR 42000: The storage engine for the table doesn't support repair partition
ALTER TABLE t1 OPTIMIZE PARTITION p1;
ERROR 42000: The storage engine for the table doesn't support optimize partition
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (s1 BIGINT UNSIGNED) CREATE TABLE t1 (s1 BIGINT UNSIGNED)
PARTITION BY RANGE (s1) ( PARTITION BY RANGE (s1) (
......
drop table if exists t1; drop table if exists t1;
# test with not null
create table t1 (a bit not null) partition by key (a);
insert into t1 values (b'1');
select hex(a) from t1 where a = b'1';
hex(a)
1
drop table t1;
create table t1 (a tinyint not null) partition by key (a); create table t1 (a tinyint not null) partition by key (a);
insert into t1 values (2); insert into t1 values (2);
select * from t1 where a = 2; select * from t1 where a = 2;
...@@ -30,22 +37,22 @@ a ...@@ -30,22 +37,22 @@ a
2 2
drop table t1; drop table t1;
create table t1 (a float not null) partition by key (a); create table t1 (a float not null) partition by key (a);
insert into t1 values (2.1); insert into t1 values (0.5);
select * from t1 where a = 2.1; select * from t1 where a = 0.5;
a a
0.5
drop table t1; drop table t1;
create table t1 (a double not null) partition by key (a); create table t1 (a double not null) partition by key (a);
insert into t1 values (2.1); insert into t1 values (0.5);
select * from t1 where a = 2.1; select * from t1 where a = 0.5;
a a
2.1 0.5
drop table t1; drop table t1;
create table t1 (a decimal not null) partition by key (a); create table t1 (a decimal(4,2) not null) partition by key (a);
insert into t1 values (2.1); insert into t1 values (2.1);
Warnings:
Note 1265 Data truncated for column 'a' at row 1
select * from t1 where a = 2.1; select * from t1 where a = 2.1;
a a
2.10
drop table t1; drop table t1;
create table t1 (a date not null) partition by key (a); create table t1 (a date not null) partition by key (a);
insert into t1 values ('2001-01-01'); insert into t1 values ('2001-01-01');
...@@ -125,6 +132,21 @@ select * from t1 where a = 'y'; ...@@ -125,6 +132,21 @@ select * from t1 where a = 'y';
a a
y y
drop table t1; drop table t1;
# test with null allowed
create table t1 (a bit) partition by key (a);
insert into t1 values (b'1');
insert into t1 values (NULL);
select hex(a) from t1 where a = b'1';
hex(a)
1
select hex(a) from t1 where a is NULL;
hex(a)
NULL
select hex(a) from t1 order by a;
hex(a)
NULL
1
drop table t1;
create table t1 (a tinyint) partition by key (a); create table t1 (a tinyint) partition by key (a);
insert into t1 values (2); insert into t1 values (2);
select * from t1 where a = 2; select * from t1 where a = 2;
...@@ -156,22 +178,22 @@ a ...@@ -156,22 +178,22 @@ a
2 2
drop table t1; drop table t1;
create table t1 (a float) partition by key (a); create table t1 (a float) partition by key (a);
insert into t1 values (2.1); insert into t1 values (0.5);
select * from t1 where a = 2.1; select * from t1 where a = 0.5;
a a
0.5
drop table t1; drop table t1;
create table t1 (a double) partition by key (a); create table t1 (a double) partition by key (a);
insert into t1 values (2.1); insert into t1 values (0.5);
select * from t1 where a = 2.1; select * from t1 where a = 0.5;
a a
2.1 0.5
drop table t1; drop table t1;
create table t1 (a decimal) partition by key (a); create table t1 (a decimal(4,2)) partition by key (a);
insert into t1 values (2.1); insert into t1 values (2.1);
Warnings:
Note 1265 Data truncated for column 'a' at row 1
select * from t1 where a = 2.1; select * from t1 where a = 2.1;
a a
2.10
drop table t1; drop table t1;
create table t1 (a date) partition by key (a); create table t1 (a date) partition by key (a);
insert into t1 values ('2001-01-01'); insert into t1 values ('2001-01-01');
...@@ -254,25 +276,41 @@ drop table t1; ...@@ -254,25 +276,41 @@ drop table t1;
create table t1 (a varchar(65531)) partition by key (a); create table t1 (a varchar(65531)) partition by key (a);
insert into t1 values ('bbbb'); insert into t1 values ('bbbb');
insert into t1 values ('aaaa'); insert into t1 values ('aaaa');
select * from t1 where a = 'aaa%'; select * from t1 where a = 'aaaa';
a a
aaaa
select * from t1 where a like 'aaa%'; select * from t1 where a like 'aaa%';
a a
aaaa aaaa
select * from t1 where a = 'bbbb';
a
bbbb
drop table t1; drop table t1;
create table t1 (a varchar(65532)) partition by key (a); create table t1 (a varchar(65532)) partition by key (a);
insert into t1 values ('bbbb'); insert into t1 values ('bbbb');
insert into t1 values ('aaaa'); insert into t1 values ('aaaa');
select * from t1 where a = 'aaa%'; select * from t1 where a = 'aaaa';
a a
aaaa
select * from t1 where a like 'aaa%'; select * from t1 where a like 'aaa%';
a a
aaaa aaaa
select * from t1 where a = 'bbbb';
a
bbbb
drop table t1; drop table t1;
create table t1 (a varchar(65533) not null) partition by key (a); create table t1 (a varchar(65533) not null) partition by key (a);
insert into t1 values ('bbbb');
insert into t1 values ('aaaa'); insert into t1 values ('aaaa');
select * from t1 where a = 'aaa%'; select * from t1 where a = 'aaaa';
a
aaaa
select * from t1 where a like 'aaa%';
a a
aaaa
select * from t1 where a = 'bbbb';
a
bbbb
drop table t1; drop table t1;
create table t1 (a varchar(65533)) partition by key (a); create table t1 (a varchar(65533)) partition by key (a);
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs
...@@ -280,3 +318,17 @@ create table t1 (a varchar(65534) not null) partition by key (a); ...@@ -280,3 +318,17 @@ create table t1 (a varchar(65534) not null) partition by key (a);
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs
create table t1 (a varchar(65535)) partition by key (a); create table t1 (a varchar(65535)) partition by key (a);
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs
create table t1 (a bit(27), primary key (a)) engine=myisam
partition by hash (a)
(partition p0, partition p1, partition p2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bit(27) NOT NULL DEFAULT '\0\0\0\0',
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM, PARTITION p2 ENGINE = MyISAM) */
insert into t1 values (1),(4),(7),(10),(13),(16),(19),(22),(25),(28),(31),(34);
select hex(a) from t1 where a = 7;
hex(a)
7
drop table t1;
drop table if exists t1; drop table if exists t1;
CREATE TABLE t1 (a INT)
PARTITION BY HASH (a)
( PARTITION p0 ENGINE=MyISAM,
PARTITION p1);
ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL
CREATE TABLE t1 (a INT)
PARTITION BY LIST (a)
SUBPARTITION BY HASH (a)
( PARTITION p0 VALUES IN (0)
( SUBPARTITION s0, SUBPARTITION s1 ENGINE=MyISAM, SUBPARTITION s2),
PARTITION p1 VALUES IN (1)
( SUBPARTITION s3 ENGINE=MyISAM, SUBPARTITION s4, SUBPARTITION s5 ENGINE=MyISAM));
ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL
CREATE TABLE t1 ( CREATE TABLE t1 (
a int a int
) )
......
...@@ -79,8 +79,7 @@ engine = innodb ...@@ -79,8 +79,7 @@ engine = innodb
partition by list (a) partition by list (a)
(partition p0 values in (0)); (partition p0 values in (0));
alter table t1 engine = x; alter table t1 engine = x;
Warnings: ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL
Warning 1286 Unknown table engine 'x'
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -151,9 +150,11 @@ DROP TABLE t1; ...@@ -151,9 +150,11 @@ DROP TABLE t1;
create table t1 (int_column int, char_column char(5)) create table t1 (int_column int, char_column char(5))
PARTITION BY RANGE (int_column) subpartition by key (char_column) subpartitions 2 PARTITION BY RANGE (int_column) subpartition by key (char_column) subpartitions 2
(PARTITION p1 VALUES LESS THAN (5) ENGINE = InnoDB); (PARTITION p1 VALUES LESS THAN (5) ENGINE = InnoDB);
alter table t1 PARTITION BY RANGE (int_column) alter table t1
ENGINE = MyISAM
PARTITION BY RANGE (int_column)
subpartition by key (char_column) subpartitions 2 subpartition by key (char_column) subpartitions 2
(PARTITION p1 VALUES LESS THAN (5) ENGINE = myisam); (PARTITION p1 VALUES LESS THAN (5));
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
......
...@@ -3,13 +3,13 @@ partition by range (a) ...@@ -3,13 +3,13 @@ partition by range (a)
subpartition by hash (a) subpartition by hash (a)
(partition p0 VALUES LESS THAN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp' (partition p0 VALUES LESS THAN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp'
(SUBPARTITION subpart00, SUBPARTITION subpart01)); (SUBPARTITION subpart00, SUBPARTITION subpart01));
Checking if file exists before alter # Checking if file exists before alter
ALTER TABLE t1 REORGANIZE PARTITION p0 INTO ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
(partition p1 VALUES LESS THAN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp' (partition p1 VALUES LESS THAN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp'
(SUBPARTITION subpart10, SUBPARTITION subpart11), (SUBPARTITION subpart10, SUBPARTITION subpart11),
partition p2 VALUES LESS THAN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp' partition p2 VALUES LESS THAN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp'
(SUBPARTITION subpart20, SUBPARTITION subpart21)); (SUBPARTITION subpart20, SUBPARTITION subpart21));
Checking if file exists after alter # Checking if file exists after alter
drop table t1; drop table t1;
set @org_mode=@@sql_mode; set @org_mode=@@sql_mode;
set @@sql_mode='NO_DIR_IN_CREATE'; set @@sql_mode='NO_DIR_IN_CREATE';
...@@ -23,6 +23,9 @@ partition p01 values less than (1000) ...@@ -23,6 +23,9 @@ partition p01 values less than (1000)
data directory='/not/existing' data directory='/not/existing'
index directory='/not/existing' index directory='/not/existing'
); );
Warnings:
Warning 0 DATA DIRECTORY option ignored
Warning 0 INDEX DIRECTORY option ignored
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
...@@ -33,11 +36,11 @@ set @@sql_mode=@org_mode; ...@@ -33,11 +36,11 @@ set @@sql_mode=@org_mode;
CREATE TABLE t1(a INT) CREATE TABLE t1(a INT)
PARTITION BY KEY (a) PARTITION BY KEY (a)
(PARTITION p0 DATA DIRECTORY 'TEST_DIR/master-data/test'); (PARTITION p0 DATA DIRECTORY 'TEST_DIR/master-data/test');
ERROR HY000: Incorrect arguments to DATA DIRECORY ERROR HY000: Incorrect arguments to DATA DIRECTORY
CREATE TABLE t1(a INT) CREATE TABLE t1(a INT)
PARTITION BY KEY (a) PARTITION BY KEY (a)
(PARTITION p0 INDEX DIRECTORY 'TEST_DIR/master-data/test'); (PARTITION p0 INDEX DIRECTORY 'TEST_DIR/master-data/test');
ERROR HY000: Incorrect arguments to INDEX DIRECORY ERROR HY000: Incorrect arguments to INDEX DIRECTORY
CREATE TABLE ts (id INT, purchased DATE) CREATE TABLE ts (id INT, purchased DATE)
PARTITION BY RANGE(YEAR(purchased)) PARTITION BY RANGE(YEAR(purchased))
SUBPARTITION BY HASH(TO_DAYS(purchased)) ( SUBPARTITION BY HASH(TO_DAYS(purchased)) (
...@@ -47,7 +50,7 @@ DATA DIRECTORY = 'TEST_DIR/master-data/test', ...@@ -47,7 +50,7 @@ DATA DIRECTORY = 'TEST_DIR/master-data/test',
SUBPARTITION s0b SUBPARTITION s0b
DATA DIRECTORY = 'TEST_DIR/master-data/test' DATA DIRECTORY = 'TEST_DIR/master-data/test'
)); ));
ERROR HY000: Incorrect arguments to DATA DIRECORY ERROR HY000: Incorrect arguments to DATA DIRECTORY
CREATE TABLE ts (id INT, purchased DATE) CREATE TABLE ts (id INT, purchased DATE)
PARTITION BY RANGE(YEAR(purchased)) PARTITION BY RANGE(YEAR(purchased))
SUBPARTITION BY HASH(TO_DAYS(purchased)) ( SUBPARTITION BY HASH(TO_DAYS(purchased)) (
...@@ -57,7 +60,7 @@ INDEX DIRECTORY = 'TEST_DIR/master-data/test', ...@@ -57,7 +60,7 @@ INDEX DIRECTORY = 'TEST_DIR/master-data/test',
SUBPARTITION s0b SUBPARTITION s0b
INDEX DIRECTORY = 'TEST_DIR/master-data/test' INDEX DIRECTORY = 'TEST_DIR/master-data/test'
)); ));
ERROR HY000: Incorrect arguments to INDEX DIRECORY ERROR HY000: Incorrect arguments to INDEX DIRECTORY
DROP TABLE IF EXISTS `example`; DROP TABLE IF EXISTS `example`;
CREATE TABLE `example` ( CREATE TABLE `example` (
`ID_EXAMPLE` int(10) unsigned NOT NULL AUTO_INCREMENT, `ID_EXAMPLE` int(10) unsigned NOT NULL AUTO_INCREMENT,
...@@ -66,9 +69,27 @@ CREATE TABLE `example` ( ...@@ -66,9 +69,27 @@ CREATE TABLE `example` (
PRIMARY KEY (`ID_EXAMPLE`) PRIMARY KEY (`ID_EXAMPLE`)
) ENGINE = MYISAM ) ENGINE = MYISAM
PARTITION BY HASH(ID_EXAMPLE)( PARTITION BY HASH(ID_EXAMPLE)(
PARTITION p0 DATA DIRECTORY = '/build/5.1/data/partitiontest/p0Data', PARTITION p0 DATA DIRECTORY = 'MYSQLTEST_VARDIR/p0Data'
PARTITION p1 DATA DIRECTORY = '/build/5.1/data/partitiontest/p1Data', INDEX DIRECTORY = 'MYSQLTEST_VARDIR/p0Index',
PARTITION p2 DATA DIRECTORY = '/build/5.1/data/partitiontest/p2Data', PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/p1Data'
PARTITION p3 DATA DIRECTORY = '/build/5.1/data/partitiontest/p3Data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/p1Index',
PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/p2Data'
INDEX DIRECTORY = 'MYSQLTEST_VARDIR/p2Index',
PARTITION p3 DATA DIRECTORY = 'MYSQLTEST_VARDIR/p3Data'
INDEX DIRECTORY = 'MYSQLTEST_VARDIR/p3Index'
); );
ERROR HY000: Can't create/write to file '/build/5.1/data/partitiontest/p0Data/example#P#p0.MYD' (Errcode: 2) # Checking that MyISAM .MYD and .MYI are in test db and data/idx dir
DROP TABLE example;
CREATE TABLE `example` (
`ID_EXAMPLE` int(10) unsigned NOT NULL AUTO_INCREMENT,
`DESCRIPTION` varchar(30) NOT NULL,
`LEVEL` smallint(5) unsigned DEFAULT NULL,
PRIMARY KEY (`ID_EXAMPLE`)
) ENGINE = MYISAM
PARTITION BY HASH(ID_EXAMPLE)(
PARTITION p0 DATA DIRECTORY = '/not/existent/p0Data',
PARTITION p1 DATA DIRECTORY = '/not/existent/p1Data',
PARTITION p2 DATA DIRECTORY = '/not/existent/p2Data',
PARTITION p3 DATA DIRECTORY = '/not/existent/p3Data'
);
Got one of the listed errors
drop table if exists t1, t2; drop table if exists t1, t2;
create table t1 (a int)
partition by range (a)
( partition p0 values less than (maxvalue));
alter table t1 add partition (partition p1 values less than (100000));
ERROR HY000: MAXVALUE can only be used in last partition definition
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
drop table t1;
create table t1 (a integer)
partition by range (a)
( partition p0 values less than (4),
partition p1 values less than (100));
create trigger tr1 before insert on t1
for each row begin
set @a = 1;
end|
alter table t1 drop partition p0;
drop table t1;
create table t1 (a integer)
partition by range (a)
( partition p0 values less than (4),
partition p1 values less than (100));
LOCK TABLES t1 WRITE;
alter table t1 drop partition p0;
alter table t1 reorganize partition p1 into
( partition p0 values less than (4),
partition p1 values less than (100));
alter table t1 add partition ( partition p2 values less than (200));
UNLOCK TABLES;
drop table t1;
create table t1 (a int unsigned) create table t1 (a int unsigned)
partition by range (a) partition by range (a)
(partition pnull values less than (0), (partition pnull values less than (0),
......
...@@ -81,3 +81,41 @@ Got one of the listed errors ...@@ -81,3 +81,41 @@ Got one of the listed errors
DROP DATABASE mysqltest2; DROP DATABASE mysqltest2;
USE test; USE test;
DROP USER mysqltest_1@localhost; DROP USER mysqltest_1@localhost;
create table t2 (i int )
partition by range (i)
(
partition p01 values less than (1000)
data directory="MYSQLTEST_VARDIR/tmp"
index directory="MYSQLTEST_VARDIR/tmp"
);
set @org_mode=@@sql_mode;
set @@sql_mode='NO_DIR_IN_CREATE';
select @@sql_mode;
@@sql_mode
NO_DIR_IN_CREATE
create table t1 (i int )
partition by range (i)
(
partition p01 values less than (1000)
data directory='/not/existing'
index directory='/not/existing'
);
Warnings:
Warning 0 DATA DIRECTORY option ignored
Warning 0 INDEX DIRECTORY option ignored
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (i) (PARTITION p01 VALUES LESS THAN (1000) ENGINE = MyISAM) */
DROP TABLE t1, t2;
set @@sql_mode=@org_mode;
create table t1 (a int)
partition by key (a)
(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
ERROR 42000: Incorrect table name 'part-data'
create table t1 (a int)
partition by key (a)
(partition p0,
partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
ERROR 42000: Incorrect table name 'part-data'
DROP TABLE IF EXISTS `example`; DROP TABLE IF EXISTS t1;
CREATE TABLE `example` ( CREATE TABLE t1 (
`ID_EXAMPLE` int(10) unsigned NOT NULL AUTO_INCREMENT, c1 int(10) unsigned NOT NULL AUTO_INCREMENT,
`DESCRIPTION` varchar(30) NOT NULL, c2 varchar(30) NOT NULL,
`LEVEL` smallint(5) unsigned DEFAULT NULL, c3 smallint(5) unsigned DEFAULT NULL,
PRIMARY KEY (`ID_EXAMPLE`) PRIMARY KEY (c1)
) ENGINE = MYISAM ) ENGINE = MYISAM
PARTITION BY HASH(ID_EXAMPLE)( PARTITION BY HASH(c1)(
PARTITION p0 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p0Data', PARTITION p0
PARTITION p1 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p1Data', DATA DIRECTORY = 'C:/mysqltest/p0Data'
PARTITION p2 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p2Data', INDEX DIRECTORY = 'D:/mysqltest/p0Index',
PARTITION p3 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p3Data' PARTITION p1,
PARTITION p2
DATA DIRECTORY = 'E:/mysqltest/p2Data'
INDEX DIRECTORY = 'F:/mysqltest/p2Index'
); );
ERROR HY000: Can't create/write to file 'C:\build\5.1\data\partitiontest\p0Data\example#P#p0.MYD' (Errcode: 2) Warnings:
Warning 0 DATA DIRECTORY option ignored
Warning 0 INDEX DIRECTORY option ignored
Warning 0 DATA DIRECTORY option ignored
Warning 0 INDEX DIRECTORY option ignored
INSERT INTO t1 VALUES (NULL, "first", 1);
INSERT INTO t1 VALUES (NULL, "second", 2);
INSERT INTO t1 VALUES (NULL, "third", 3);
ALTER TABLE t1 ADD PARTITION (PARTITION p3 DATA DIRECTORY = 'G:/mysqltest/p3Data' INDEX DIRECTORY = 'H:/mysqltest/p3Index');
Warnings:
Warning 0 DATA DIRECTORY option ignored
Warning 0 INDEX DIRECTORY option ignored
INSERT INTO t1 VALUES (NULL, "last", 4);
DROP TABLE t1;
SELECT @@global.example_enum_var = 'e2';
@@global.example_enum_var = 'e2'
1
...@@ -1664,6 +1664,32 @@ set GLOBAL query_cache_type=default; ...@@ -1664,6 +1664,32 @@ set GLOBAL query_cache_type=default;
set GLOBAL query_cache_limit=default; set GLOBAL query_cache_limit=default;
set GLOBAL query_cache_min_res_unit=default; set GLOBAL query_cache_min_res_unit=default;
set GLOBAL query_cache_size=default; set GLOBAL query_cache_size=default;
FLUSH STATUS;
SET GLOBAL query_cache_size=10*1024*1024;
SET @save_concurrent_insert= @@concurrent_insert;
SET GLOBAL concurrent_insert= 0;
CREATE TABLE t1 (c1 INT NOT NULL) ENGINE=MyISAM;
INSERT INTO t1 (c1) VALUES (1), (2);
SHOW GLOBAL VARIABLES LIKE 'concurrent_insert';
Variable_name Value
concurrent_insert 0
SHOW STATUS LIKE 'Qcache_hits';
Variable_name Value
Qcache_hits 0
SELECT * FROM t1;
c1
1
2
SELECT * FROM t1;
c1
1
2
SHOW STATUS LIKE 'Qcache_hits';
Variable_name Value
Qcache_hits 1
DROP TABLE t1;
SET GLOBAL concurrent_insert= @save_concurrent_insert;
SET GLOBAL query_cache_size= default;
End of 5.0 tests End of 5.0 tests
CREATE TABLE t1 (a ENUM('rainbow')); CREATE TABLE t1 (a ENUM('rainbow'));
INSERT INTO t1 VALUES (),(),(),(),(); INSERT INTO t1 VALUES (),(),(),(),();
......
...@@ -22,6 +22,7 @@ insert into t1 (b) select b from t2; ...@@ -22,6 +22,7 @@ insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1; insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2; insert into t1 (b) select b from t2;
drop table t2; drop table t2;
create table t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="MYSQLTEST_VARDIR/tmp" index directory="MYSQLTEST_VARDIR/run";
insert into t9 select * from t1; insert into t9 select * from t1;
check table t9; check table t9;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
...@@ -54,10 +55,16 @@ t9 CREATE TABLE `t9` ( ...@@ -54,10 +55,16 @@ t9 CREATE TABLE `t9` (
`d` int(11) NOT NULL, `d` int(11) NOT NULL,
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=MyISAM AUTO_INCREMENT=16725 DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/' ) ENGINE=MyISAM AUTO_INCREMENT=16725 DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/'
create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="tmp";
Got one of the listed errors Got one of the listed errors
create database mysqltest;
create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="/this-dir-does-not-exist";
Got one of the listed errors Got one of the listed errors
create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="not-hard-path";
Got one of the listed errors Got one of the listed errors
create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="MYSQLTEST_VARDIR/run";
Got one of the listed errors Got one of the listed errors
create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="MYSQLTEST_VARDIR/tmp";
Got one of the listed errors Got one of the listed errors
alter table t9 rename mysqltest.t9; alter table t9 rename mysqltest.t9;
select count(*) from mysqltest.t9; select count(*) from mysqltest.t9;
...@@ -74,6 +81,7 @@ t9 CREATE TABLE `t9` ( ...@@ -74,6 +81,7 @@ t9 CREATE TABLE `t9` (
) ENGINE=MyISAM AUTO_INCREMENT=16725 DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/' ) ENGINE=MyISAM AUTO_INCREMENT=16725 DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/'
drop database mysqltest; drop database mysqltest;
create table t1 (a int not null) engine=myisam; create table t1 (a int not null) engine=myisam;
alter table t1 data directory="MYSQLTEST_VARDIR/tmp";
Warnings: Warnings:
Warning 0 DATA DIRECTORY option ignored Warning 0 DATA DIRECTORY option ignored
show create table t1; show create table t1;
...@@ -82,6 +90,7 @@ t1 CREATE TABLE `t1` ( ...@@ -82,6 +90,7 @@ t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL `a` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 add b int; alter table t1 add b int;
alter table t1 data directory="MYSQLTEST_VARDIR/log";
Warnings: Warnings:
Warning 0 DATA DIRECTORY option ignored Warning 0 DATA DIRECTORY option ignored
show create table t1; show create table t1;
...@@ -90,6 +99,7 @@ t1 CREATE TABLE `t1` ( ...@@ -90,6 +99,7 @@ t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL, `a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL `b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 index directory="MYSQLTEST_VARDIR/log";
Warnings: Warnings:
Warning 0 INDEX DIRECTORY option ignored Warning 0 INDEX DIRECTORY option ignored
show create table t1; show create table t1;
...@@ -102,18 +112,20 @@ drop table t1; ...@@ -102,18 +112,20 @@ drop table t1;
CREATE TABLE t1(a INT) CREATE TABLE t1(a INT)
DATA DIRECTORY='TEST_DIR/tmp' DATA DIRECTORY='TEST_DIR/tmp'
INDEX DIRECTORY='TEST_DIR/tmp'; INDEX DIRECTORY='TEST_DIR/tmp';
ERROR HY000: Can't create/write to file 'TEST_DIR/tmp/t1.MYI' (Errcode: 17) Got one of the listed errors
CREATE TABLE t2(a INT) CREATE TABLE t2(a INT)
DATA DIRECTORY='TEST_DIR/tmp' DATA DIRECTORY='TEST_DIR/tmp'
INDEX DIRECTORY='TEST_DIR/tmp'; INDEX DIRECTORY='TEST_DIR/tmp';
RENAME TABLE t2 TO t1; RENAME TABLE t2 TO t1;
ERROR HY000: Can't create/write to file 'TEST_DIR/tmp/t1.MYI' (Errcode: 17) ERROR HY000: Can't create/write to file 'TEST_DIR/tmp/t1.MYI' (Errcode: 17)
DROP TABLE t2; DROP TABLE t2;
create temporary table t1 (a int) engine=myisam data directory="MYSQLTEST_VARDIR/log" select 9 a;
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TEMPORARY TABLE `t1` ( t1 CREATE TEMPORARY TABLE `t1` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/log/' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/log/'
create temporary table t1 (a int) engine=myisam data directory="MYSQLTEST_VARDIR/log" select 99 a;
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TEMPORARY TABLE `t1` ( t1 CREATE TEMPORARY TABLE `t1` (
...@@ -140,16 +152,24 @@ DROP TABLE t1; ...@@ -140,16 +152,24 @@ DROP TABLE t1;
End of 5.0 tests End of 5.0 tests
CREATE TABLE t1(a INT) CREATE TABLE t1(a INT)
INDEX DIRECTORY='TEST_DIR/master-data/mysql'; INDEX DIRECTORY='TEST_DIR/master-data/mysql';
ERROR HY000: Incorrect arguments to INDEX DIRECORY ERROR HY000: Incorrect arguments to INDEX DIRECTORY
CREATE TABLE t1(a INT) CREATE TABLE t1(a INT)
DATA DIRECTORY='TEST_DIR/master-data/test'; DATA DIRECTORY='TEST_DIR/master-data/test';
ERROR HY000: Incorrect arguments to DATA DIRECORY ERROR HY000: Incorrect arguments to DATA DIRECTORY
CREATE TABLE t1(a INT) CREATE TABLE t1(a INT)
DATA DIRECTORY='TEST_DIR/master-data/'; DATA DIRECTORY='TEST_DIR/master-data/';
DROP TABLE t1; ERROR HY000: Incorrect arguments to DATA DIRECTORY
CREATE TABLE t1(a INT) CREATE TABLE t1(a INT)
INDEX DIRECTORY='TEST_DIR/master-data'; INDEX DIRECTORY='TEST_DIR/master-data';
DROP TABLE t1; ERROR HY000: Incorrect arguments to INDEX DIRECTORY
CREATE TABLE t1(a INT) CREATE TABLE t1(a INT)
INDEX DIRECTORY='TEST_DIR/master-data_var'; INDEX DIRECTORY='TEST_DIR/master-data_var';
ERROR HY000: Can't create/write to file 'TEST_DIR/master-data_var/t1.MYI' (Errcode: 2) ERROR HY000: Can't create/write to file 'TEST_DIR/master-data_var/t1.MYI' (Errcode: 2)
SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='NO_DIR_IN_CREATE';
CREATE TABLE t1(a INT) DATA DIRECTORY='MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY='MYSQLTEST_VARDIR/tmp';
Warnings:
Warning 0 DATA DIRECTORY option ignored
Warning 0 INDEX DIRECTORY option ignored
DROP TABLE t1;
SET @@SQL_MODE=@OLD_SQL_MODE;
End of 5.1 tests
...@@ -93,3 +93,4 @@ c ...@@ -93,3 +93,4 @@ c
1,2,3 1,2,3
64 64
DROP TABLE t1; DROP TABLE t1;
End of 5.0 tests
...@@ -6,6 +6,8 @@ SET @test_character_set= 'cp932'; ...@@ -6,6 +6,8 @@ SET @test_character_set= 'cp932';
SET @test_collation= 'cp932_japanese_ci'; SET @test_collation= 'cp932_japanese_ci';
SET @safe_character_set_server= @@character_set_server; SET @safe_character_set_server= @@character_set_server;
SET @safe_collation_server= @@collation_server; SET @safe_collation_server= @@collation_server;
SET @safe_character_set_client= @@character_set_client;
SET @safe_character_set_results= @@character_set_results;
SET character_set_server= @test_character_set; SET character_set_server= @test_character_set;
SET collation_server= @test_collation; SET collation_server= @test_collation;
CREATE DATABASE d1; CREATE DATABASE d1;
...@@ -72,10 +74,27 @@ select 1 from t1 order by cast(a as char(1)); ...@@ -72,10 +74,27 @@ select 1 from t1 order by cast(a as char(1));
1 1
1 1
drop table t1; drop table t1;
set names utf8;
create table t1 (
name varchar(10),
level smallint unsigned);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`name` varchar(10) DEFAULT NULL,
`level` smallint(5) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=cp932
insert into t1 values ('string',1);
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
concat(name,space(level)) concat(name, repeat(' ',level))
string string
drop table t1;
DROP DATABASE d1; DROP DATABASE d1;
USE test; USE test;
SET character_set_server= @safe_character_set_server; SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server; SET collation_server= @safe_collation_server;
SET character_set_client= @safe_character_set_client;
SET character_set_results= @safe_character_set_results;
set names cp932; set names cp932;
set character_set_database = cp932; set character_set_database = cp932;
CREATE TABLE t1(c1 CHAR(1)) DEFAULT CHARACTER SET = cp932; CREATE TABLE t1(c1 CHAR(1)) DEFAULT CHARACTER SET = cp932;
......
...@@ -6,6 +6,8 @@ SET @test_character_set= 'cp932'; ...@@ -6,6 +6,8 @@ SET @test_character_set= 'cp932';
SET @test_collation= 'cp932_japanese_ci'; SET @test_collation= 'cp932_japanese_ci';
SET @safe_character_set_server= @@character_set_server; SET @safe_character_set_server= @@character_set_server;
SET @safe_collation_server= @@collation_server; SET @safe_collation_server= @@collation_server;
SET @safe_character_set_client= @@character_set_client;
SET @safe_character_set_results= @@character_set_results;
SET character_set_server= @test_character_set; SET character_set_server= @test_character_set;
SET collation_server= @test_collation; SET collation_server= @test_collation;
CREATE DATABASE d1; CREATE DATABASE d1;
...@@ -72,10 +74,27 @@ select 1 from t1 order by cast(a as char(1)); ...@@ -72,10 +74,27 @@ select 1 from t1 order by cast(a as char(1));
1 1
1 1
drop table t1; drop table t1;
set names utf8;
create table t1 (
name varchar(10),
level smallint unsigned);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`name` varchar(10) DEFAULT NULL,
`level` smallint(5) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=cp932
insert into t1 values ('string',1);
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
concat(name,space(level)) concat(name, repeat(' ',level))
string string
drop table t1;
DROP DATABASE d1; DROP DATABASE d1;
USE test; USE test;
SET character_set_server= @safe_character_set_server; SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server; SET collation_server= @safe_collation_server;
SET character_set_client= @safe_character_set_client;
SET character_set_results= @safe_character_set_results;
set names cp932; set names cp932;
set character_set_database = cp932; set character_set_database = cp932;
CREATE TABLE t1(c1 CHAR(1)) DEFAULT CHARACTER SET = cp932; CREATE TABLE t1(c1 CHAR(1)) DEFAULT CHARACTER SET = cp932;
......
...@@ -10,6 +10,8 @@ execute s using @a; ...@@ -10,6 +10,8 @@ execute s using @a;
prepare s from "insert into t1 select 100 limit ?"; prepare s from "insert into t1 select 100 limit ?";
set @a=100; set @a=100;
execute s using @a; execute s using @a;
Warnings:
Warning 1592 Statement is not safe to log in statement format.
show binlog events from <binlog_start>; show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; create table t1 (a int) master-bin.000001 # Query # # use `test`; create table t1 (a int)
......
...@@ -192,3 +192,31 @@ DROP PROCEDURE proc4; ...@@ -192,3 +192,31 @@ DROP PROCEDURE proc4;
DROP FUNCTION func5; DROP FUNCTION func5;
DROP PREPARE prep6; DROP PREPARE prep6;
DROP TABLE t1, t2, t3, trigger_table, trigger_table2; DROP TABLE t1, t2, t3, trigger_table, trigger_table2;
CREATE TABLE t1(a INT, b INT, KEY(a), PRIMARY KEY(b));
INSERT INTO t1 SELECT * FROM t1 LIMIT 1;
Warnings:
Warning 1592 Statement is not safe to log in statement format.
REPLACE INTO t1 SELECT * FROM t1 LIMIT 1;
Warnings:
Warning 1592 Statement is not safe to log in statement format.
UPDATE t1 SET a=1 LIMIT 1;
Warnings:
Warning 1592 Statement is not safe to log in statement format.
DELETE FROM t1 LIMIT 1;
Warnings:
Warning 1592 Statement is not safe to log in statement format.
CREATE PROCEDURE p1()
BEGIN
INSERT INTO t1 SELECT * FROM t1 LIMIT 1;
REPLACE INTO t1 SELECT * FROM t1 LIMIT 1;
UPDATE t1 SET a=1 LIMIT 1;
DELETE FROM t1 LIMIT 1;
END|
CALL p1();
Warnings:
Warning 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format.
DROP PROCEDURE p1;
DROP TABLE t1;
# This test is to verify replication with PS # This test is to verify replication with PS
-- source include/not_embedded.inc -- source include/not_embedded.inc
-- source include/have_binlog_format_mixed_or_statement.inc -- source include/have_binlog_format_statement.inc
-- disable_query_log -- disable_query_log
reset master; # get rid of previous tests binlog reset master; # get rid of previous tests binlog
......
...@@ -236,3 +236,24 @@ DROP PROCEDURE proc4; ...@@ -236,3 +236,24 @@ DROP PROCEDURE proc4;
DROP FUNCTION func5; DROP FUNCTION func5;
DROP PREPARE prep6; DROP PREPARE prep6;
DROP TABLE t1, t2, t3, trigger_table, trigger_table2; DROP TABLE t1, t2, t3, trigger_table, trigger_table2;
#
# BUG#34768 - nondeterministic INSERT using LIMIT logged in stmt mode if
# binlog_format=mixed
#
CREATE TABLE t1(a INT, b INT, KEY(a), PRIMARY KEY(b));
INSERT INTO t1 SELECT * FROM t1 LIMIT 1;
REPLACE INTO t1 SELECT * FROM t1 LIMIT 1;
UPDATE t1 SET a=1 LIMIT 1;
DELETE FROM t1 LIMIT 1;
delimiter |;
CREATE PROCEDURE p1()
BEGIN
INSERT INTO t1 SELECT * FROM t1 LIMIT 1;
REPLACE INTO t1 SELECT * FROM t1 LIMIT 1;
UPDATE t1 SET a=1 LIMIT 1;
DELETE FROM t1 LIMIT 1;
END|
delimiter ;|
CALL p1();
DROP PROCEDURE p1;
DROP TABLE t1;
...@@ -105,6 +105,12 @@ PARTITION BY KEY(a) ...@@ -105,6 +105,12 @@ PARTITION BY KEY(a)
drop table t1; drop table t1;
CREATE TABLE t1 (a int not null primary key); CREATE TABLE t1 (a int not null primary key);
ALTER TABLE t1 ALTER TABLE t1
ENGINE = NDB
PARTITION BY KEY(a)
(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
drop table t1;
CREATE TABLE t1 (a int not null primary key) ENGINE = NDB;
ALTER TABLE t1
PARTITION BY KEY(a) PARTITION BY KEY(a)
(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB); (PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
drop table t1; drop table t1;
...@@ -160,7 +166,6 @@ t1 CREATE TABLE `t1` ( ...@@ -160,7 +166,6 @@ t1 CREATE TABLE `t1` (
alter table t1 alter table t1
partition by key(a) partition by key(a)
(partition p0 engine=ndb, partition p1); (partition p0 engine=ndb, partition p1);
ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL
alter table t1 alter table t1
engine=ndb engine=ndb
partition by key(a) partition by key(a)
......
...@@ -79,6 +79,14 @@ drop table t1; ...@@ -79,6 +79,14 @@ drop table t1;
CREATE TABLE t1 (a int not null primary key); CREATE TABLE t1 (a int not null primary key);
ALTER TABLE t1 ALTER TABLE t1
ENGINE = NDB
PARTITION BY KEY(a)
(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
drop table t1;
CREATE TABLE t1 (a int not null primary key) ENGINE = NDB;
ALTER TABLE t1
PARTITION BY KEY(a) PARTITION BY KEY(a)
(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB); (PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
...@@ -116,7 +124,10 @@ show create table t1; ...@@ -116,7 +124,10 @@ show create table t1;
alter table t1 remove partitioning; alter table t1 remove partitioning;
show create table t1; show create table t1;
--error ER_MIX_HANDLER_ERROR # after bug#31931 was fixed
# this is OK, since the storage engine is specified
# on table level before.
#--error ER_MIX_HANDLER_ERROR
alter table t1 alter table t1
partition by key(a) partition by key(a)
(partition p0 engine=ndb, partition p1); (partition p0 engine=ndb, partition p1);
......
...@@ -83,17 +83,17 @@ let $alter= ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1; ...@@ -83,17 +83,17 @@ let $alter= ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1;
--echo #------------------------------------------------------------------------ --echo #------------------------------------------------------------------------
--echo # 5 ALTER ... REPAIR PARTITION --echo # 5 ALTER ... REPAIR PARTITION
--echo #------------------------------------------------------------------------ --echo #------------------------------------------------------------------------
--echo # 5.1 ALTER ... REBUILD PARTITION part_1; --echo # 5.1 ALTER ... REPAIR PARTITION part_1;
let $alter= ALTER TABLE t1 REBUILD PARTITION part_1; let $alter= ALTER TABLE t1 REPAIR PARTITION part_1;
--source suite/parts/inc/partition_alter_41.inc --source suite/parts/inc/partition_alter_41.inc
--echo # 5.2 ALTER ... REBUILD PARTITION part_1,part_2; --echo # 5.2 ALTER ... REPAIR PARTITION part_1,part_2;
let $alter= ALTER TABLE t1 REBUILD PARTITION part_1,part_2; let $alter= ALTER TABLE t1 REPAIR PARTITION part_1,part_2;
--source suite/parts/inc/partition_alter_41.inc --source suite/parts/inc/partition_alter_41.inc
--echo # 5.3 ALTER ... REBUILD PARTITION part_1,part_2,part_5,part_6,part_10; --echo # 5.3 ALTER ... REPAIR PARTITION part_1,part_2,part_5,part_6,part_10;
let $alter= ALTER TABLE t1 REBUILD PARTITION part_1,part_2,part_5,part_6,part_10; let $alter= ALTER TABLE t1 REPAIR PARTITION part_1,part_2,part_5,part_6,part_10;
--source suite/parts/inc/partition_alter_41.inc --source suite/parts/inc/partition_alter_41.inc
--echo # 5.4 ALTER ... REBUILD PARTITION part_1,part_1,part_1; --echo # 5.4 ALTER ... REPAIR PARTITION part_1,part_1,part_1;
let $alter= ALTER TABLE t1 REBUILD PARTITION part_1,part_1,part_1; let $alter= ALTER TABLE t1 REPAIR PARTITION part_1,part_1,part_1;
--source suite/parts/inc/partition_alter_41.inc --source suite/parts/inc/partition_alter_41.inc
--echo #------------------------------------------------------------------------ --echo #------------------------------------------------------------------------
......
...@@ -30,25 +30,6 @@ ...@@ -30,25 +30,6 @@
let $unique= ; let $unique= ;
--source suite/parts/inc/partition_methods1.inc --source suite/parts/inc/partition_methods1.inc
# #
--echo # 1.1.1 with DATA DIECTORY/INDEX DIRECTORY
#
--disable_query_log
# DATA DIRECTORY
eval SET @data_dir = 'DATA DIRECTORY =
''''$MYSQLTEST_VARDIR/tmp''''';
let $data_directory = `select @data_dir`;
#INDEX DIRECTORY
eval SET @indx_dir = 'INDEX DIRECTORY =
''''$MYSQLTEST_VARDIR/tmp''''';
let $index_directory = `select @indx_dir`;
let $with_directories= 1;
--source suite/parts/inc/partition_methods1.inc
--source suite/parts/inc/partition_directory.inc
let $with_directories= 0;
--enable_query_log
#
--echo # 1.2 The partitioning function contains two columns. --echo # 1.2 The partitioning function contains two columns.
let $unique= ; let $unique= ;
--source suite/parts/inc/partition_methods2.inc --source suite/parts/inc/partition_methods2.inc
...@@ -68,24 +49,6 @@ if ($more_pk_ui_tests) ...@@ -68,24 +49,6 @@ if ($more_pk_ui_tests)
--echo # 2.2 UNIQUE INDEX consisting of one column --echo # 2.2 UNIQUE INDEX consisting of one column
let $unique= , UNIQUE INDEX uidx1 (f_int1); let $unique= , UNIQUE INDEX uidx1 (f_int1);
--source suite/parts/inc/partition_methods1.inc --source suite/parts/inc/partition_methods1.inc
--echo # 2.2.1 with DATA DIECTORY/INDEX DIRECTORY
#
--disable_query_log
# DATA DIRECTORY
eval SET @data_dir = 'DATA DIRECTORY =
''''$MYSQLTEST_VARDIR/tmp''''';
let $data_directory = `select @data_dir`;
#INDEX DIRECTORY
eval SET @indx_dir = 'INDEX DIRECTORY =
''''$MYSQLTEST_VARDIR/tmp''''';
let $index_directory = `select @indx_dir`;
let $with_directories= TRUE;
--source suite/parts/inc/partition_methods1.inc
let $with_directories= FALSE;
--enable_query_log
# #
if ($do_pk_tests) if ($do_pk_tests)
{ {
......
################################################################################
# inc/partition_basic_symlink.inc #
# #
# Purpose: #
# Basic tests around create partitioned table with/without PRIMARY KEY and #
# /or UNIQUE INDEX #
# Also includes test for DATA/INDEX DIR which requires symlinked files #
# #
#------------------------------------------------------------------------------#
# Original Author: mleich #
# Original Date: 2006-03-05 #
# Change Author: mattiasj #
# Change Date: 2008-02-06 #
# Change: copied it from partition_basic.inc and kept DATA/INDEX DIR #
################################################################################
--enable_abort_on_error
--echo
let $unique= ;
# DATA DIRECTORY
# Make directory for partition data
let $data_dir_path= $MYSQLTEST_VARDIR/mysql-test-data-dir;
--mkdir $data_dir_path
let $data_directory= DATA DIRECTORY = '$data_dir_path';
#INDEX DIRECTORY
# Make directory for partition index
let $idx_dir_path= $MYSQLTEST_VARDIR/mysql-test-idx-dir;
--mkdir $idx_dir_path
let $index_directory= INDEX DIRECTORY = '$idx_dir_path';
let $with_directories= 1;
--echo #========================================================================
--echo # 0.5 use partition_basic with DATA/INDEX DIRECTORY
--echo #========================================================================
--source suite/parts/inc/partition_basic.inc
--echo #========================================================================
--echo # 5 use partition_directory with DATA/INDEX DIRECTORY
--echo #========================================================================
--source suite/parts/inc/partition_directory.inc
--rmdir $data_dir_path
--rmdir $idx_dir_path
let $with_directories= 0;
--disable_query_log
# DATA DIRECTORY
eval SET @data_dir = 'DATA DIRECTORY =
''/tmp''';
let $data_directory = `select @data_dir`;
#INDEX DIRECTORY
eval SET @indx_dir = 'INDEX DIRECTORY =
''/tmp''';
let $index_directory = `select @indx_dir`;
--enable_query_log
eval create table t1 (a bigint unsigned not null, primary key(a)) engine=$engine eval create table t1 (a bigint unsigned not null, primary key(a)) engine=$engine
partition by key (a) ( partition by key (a) (
partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, partition pa1 max_rows=20 min_rows=2,
partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, partition pa2 max_rows=30 min_rows=3,
partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, partition pa3 max_rows=30 min_rows=4,
partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
show create table t1; show create table t1;
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612), (1), (2), (65535); insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612), (1), (2), (65535);
select * from t1; select * from t1;
......
--echo ---- Partitioning and binary data type --echo ---- Partitioning and binary data type
--disable_query_log
# DATA DIRECTORY
eval SET @data_dir = 'DATA DIRECTORY =
''/tmp''';
let $data_directory = `select @data_dir`;
#INDEX DIRECTORY
eval SET @indx_dir = 'INDEX DIRECTORY =
''/tmp''';
let $index_directory = `select @indx_dir`;
--enable_query_log
eval create table t1 (a binary(255) not null, primary key(a)) engine=$engine eval create table t1 (a binary(255) not null, primary key(a)) engine=$engine
partition by key (a) ( partition by key (a) (
partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, partition pa1 max_rows=20 min_rows=2,
partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, partition pa2 max_rows=30 min_rows=3,
partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, partition pa3 max_rows=30 min_rows=4,
partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
show create table t1; show create table t1;
insert into t1 values (repeat('a',255)), ('b'), (repeat('a',128)), (repeat('b',64)); insert into t1 values (repeat('a',255)), ('b'), (repeat('a',128)), (repeat('b',64));
select hex(a) from t1; select hex(a) from t1;
......
--disable_query_log
# DATA DIRECTORY
eval SET @data_dir = 'DATA DIRECTORY =
''/tmp''';
let $data_directory = `select @data_dir`;
#INDEX DIRECTORY
eval SET @indx_dir = 'INDEX DIRECTORY =
''/tmp''';
let $index_directory = `select @indx_dir`;
--enable_query_log
--disable_warnings --disable_warnings
drop table if exists t1; drop table if exists t1;
--enable_warnings --enable_warnings
...@@ -23,8 +11,8 @@ drop table t1; ...@@ -23,8 +11,8 @@ drop table t1;
eval create table t1 (a bit(0), primary key (a)) engine=$engine eval create table t1 (a bit(0), primary key (a)) engine=$engine
partition by key (a) ( partition by key (a) (
partition pa1 $data_directory $index_directory, partition pa1,
partition pa2 $data_directory $index_directory); partition pa2);
show create table t1; show create table t1;
drop table t1; drop table t1;
...@@ -37,15 +25,16 @@ insert into t1 values ...@@ -37,15 +25,16 @@ insert into t1 values
(b'0000000000000000000000000000000000000000000000000000000000000001'), (b'0000000000000000000000000000000000000000000000000000000000000001'),
(b'1010101010101010101010101010101010101010101010101010101010101010'), (b'1010101010101010101010101010101010101010101010101010101010101010'),
(b'0101010101010101010101010101010101010101010101010101010101010101'); (b'0101010101010101010101010101010101010101010101010101010101010101');
--sorted_result
select hex(a) from t1; select hex(a) from t1;
drop table t1; drop table t1;
eval create table t1 (a bit(64), primary key (a)) engine=$engine eval create table t1 (a bit(64), primary key (a)) engine=$engine
partition by key (a) ( partition by key (a) (
partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, partition pa1 max_rows=20 min_rows=2,
partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, partition pa2 max_rows=30 min_rows=3,
partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, partition pa3 max_rows=30 min_rows=4,
partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
show create table t1; show create table t1;
insert into t1 values insert into t1 values
(b'1111111111111111111111111111111111111111111111111111111111111111'), (b'1111111111111111111111111111111111111111111111111111111111111111'),
...@@ -55,6 +44,7 @@ insert into t1 values ...@@ -55,6 +44,7 @@ insert into t1 values
(b'0101010101010101010101010101010101010101010101010101010101010101'); (b'0101010101010101010101010101010101010101010101010101010101010101');
select hex(a) from t1 where a=b'0101010101010101010101010101010101010101010101010101010101010101'; select hex(a) from t1 where a=b'0101010101010101010101010101010101010101010101010101010101010101';
delete from t1 where a=b'0101010101010101010101010101010101010101010101010101010101010101'; delete from t1 where a=b'0101010101010101010101010101010101010101010101010101010101010101';
--sorted_result
select hex(a) from t1; select hex(a) from t1;
drop table t1; drop table t1;
...@@ -62,12 +52,15 @@ eval create table t2 (a bit, primary key (a)) engine=$engine ...@@ -62,12 +52,15 @@ eval create table t2 (a bit, primary key (a)) engine=$engine
partition by key (a) partitions 4; partition by key (a) partitions 4;
show create table t2; show create table t2;
insert into t2 values (b'0'), (b'1'); insert into t2 values (b'0'), (b'1');
--sorted_result
select hex(a) from t2; select hex(a) from t2;
alter table t2 drop primary key; alter table t2 drop primary key;
show create table t2; show create table t2;
--sorted_result
select hex(a) from t2; select hex(a) from t2;
alter table t2 add primary key (a); alter table t2 add primary key (a);
show create table t2; show create table t2;
--sorted_result
select hex(a) from t2; select hex(a) from t2;
drop table t2; drop table t2;
...@@ -90,6 +83,7 @@ dec $count; ...@@ -90,6 +83,7 @@ dec $count;
select hex(a) from t3 where a=b'01010101'; select hex(a) from t3 where a=b'01010101';
delete from t3 where a=b'01010101'; delete from t3 where a=b'01010101';
select count(*) from t3; select count(*) from t3;
--sorted_result
select hex(a) from t3; select hex(a) from t3;
drop table t3; drop table t3;
...@@ -111,5 +105,6 @@ dec $count; ...@@ -111,5 +105,6 @@ dec $count;
select hex(a) from t4 where a=b'00000001'; select hex(a) from t4 where a=b'00000001';
delete from t4 where a=b'00000001'; delete from t4 where a=b'00000001';
select count(*) from t4; select count(*) from t4;
--sorted_result
select hex(a) from t4; select hex(a) from t4;
drop table t4; drop table t4;
--echo ---- Partitioning and blob data type --echo ---- Partitioning and blob data type
--disable_query_log
# DATA DIRECTORY
eval SET @data_dir = 'DATA DIRECTORY =
''/tmp''';
let $data_directory = `select @data_dir`;
#INDEX DIRECTORY
eval SET @indx_dir = 'INDEX DIRECTORY =
''/tmp''';
let $index_directory = `select @indx_dir`;
--enable_query_log
--error ER_BLOB_FIELD_IN_PART_FUNC_ERROR --error ER_BLOB_FIELD_IN_PART_FUNC_ERROR
eval create table t1 (a blob not null, primary key(a(767))) engine=$engine eval create table t1 (a blob not null, primary key(a(767))) engine=$engine
partition by key (a) ( partition by key (a) (
partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, partition pa1 max_rows=20 min_rows=2,
partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, partition pa2 max_rows=30 min_rows=3,
partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, partition pa3 max_rows=30 min_rows=4,
partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
#show create table t1; #show create table t1;
#insert into t1 values (repeat('a',1000)), ('b'), (repeat('a',500)), (repeat('b',64)); #insert into t1 values (repeat('a',1000)), ('b'), (repeat('a',500)), (repeat('b',64));
......
--echo ---- Partitioning and char data type --echo ---- Partitioning and char data type
--disable_query_log
# DATA DIRECTORY
eval SET @data_dir = 'DATA DIRECTORY =
''/tmp''';
let $data_directory = `select @data_dir`;
#INDEX DIRECTORY
eval SET @indx_dir = 'INDEX DIRECTORY =
''/tmp''';
let $index_directory = `select @indx_dir`;
--enable_query_log
eval create table t1 (a char(255) not null, primary key(a)) engine=$engine eval create table t1 (a char(255) not null, primary key(a)) engine=$engine
partition by key (a) ( partition by key (a) (
partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, partition pa1 max_rows=20 min_rows=2,
partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, partition pa2 max_rows=30 min_rows=3,
partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, partition pa3 max_rows=30 min_rows=4,
partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
show create table t1; show create table t1;
insert into t1 values (repeat('a',255)), ('b'), (repeat('a',128)), (repeat('b',64)); insert into t1 values (repeat('a',255)), ('b'), (repeat('a',128)), (repeat('b',64));
select * from t1; select * from t1;
......
--disable_query_log
# DATA DIRECTORY
eval SET @data_dir = 'DATA DIRECTORY =
''/tmp''';
let $data_directory = `select @data_dir`;
#INDEX DIRECTORY
eval SET @indx_dir = 'INDEX DIRECTORY =
''/tmp''';
let $index_directory = `select @indx_dir`;
--enable_query_log
eval create table t1 (a date not null, primary key(a)) engine=$engine eval create table t1 (a date not null, primary key(a)) engine=$engine
partition by key (a) ( partition by key (a) (
partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, partition pa1 max_rows=20 min_rows=2,
partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, partition pa2 max_rows=30 min_rows=3,
partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, partition pa3 max_rows=30 min_rows=4,
partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
show create table t1; show create table t1;
insert into t1 values ('1975-01-01'), ('2020-12-31'), ('1980-10-14'), ('2000-06-15'); insert into t1 values ('1975-01-01'), ('2020-12-31'), ('1980-10-14'), ('2000-06-15');
select * from t1; select * from t1;
......
--disable_query_log
# DATA DIRECTORY
eval SET @data_dir = 'DATA DIRECTORY =
''/tmp''';
let $data_directory = `select @data_dir`;
#INDEX DIRECTORY
eval SET @indx_dir = 'INDEX DIRECTORY =
''/tmp''';
let $index_directory = `select @indx_dir`;
--enable_query_log
eval create table t1 (a datetime not null, primary key(a)) engine=$engine eval create table t1 (a datetime not null, primary key(a)) engine=$engine
partition by key (a) ( partition by key (a) (
partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, partition pa1 max_rows=20 min_rows=2,
partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, partition pa2 max_rows=30 min_rows=3,
partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, partition pa3 max_rows=30 min_rows=4,
partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
show create table t1; show create table t1;
insert into t1 values ('1975-01-01 21:21:21'), ('2020-12-31 12:10:30'), ('1980-10-14 03:03'), ('2000-06-15 23:59'); insert into t1 values ('1975-01-01 21:21:21'), ('2020-12-31 12:10:30'), ('1980-10-14 03:03'), ('2000-06-15 23:59');
select * from t1; select * from t1;
......
--disable_query_log
# DATA DIRECTORY
eval SET @data_dir = 'DATA DIRECTORY =
''/tmp''';
let $data_directory = `select @data_dir`;
#INDEX DIRECTORY
eval SET @indx_dir = 'INDEX DIRECTORY =
''/tmp''';
let $index_directory = `select @indx_dir`;
--enable_query_log
eval create table t1 (a decimal(10,4) not null, primary key(a)) engine=$engine eval create table t1 (a decimal(10,4) not null, primary key(a)) engine=$engine
partition by key (a) ( partition by key (a) (
partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, partition pa1 max_rows=20 min_rows=2,
partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, partition pa2 max_rows=30 min_rows=3,
partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, partition pa3 max_rows=30 min_rows=4,
partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
show create table t1; show create table t1;
insert into t1 values (999999.9999), (-999999.9999), (123456.7899), (-123456.7899), (-1.5), (1), (0), (-1), (1.5), (1234.567), (-1234.567); insert into t1 values (999999.9999), (-999999.9999), (123456.7899), (-123456.7899), (-1.5), (1), (0), (-1), (1.5), (1234.567), (-1234.567);
select * from t1; select * from t1;
......
...@@ -29,41 +29,35 @@ let $partitioning= ; ...@@ -29,41 +29,35 @@ let $partitioning= ;
if ($with_partitioning) if ($with_partitioning)
{ {
let $partitioning= PARTITION BY HASH(f_int1) PARTITIONS 2; let $partitioning= PARTITION BY HASH(f_int1) PARTITIONS 2;
--disable_query_log
if ($with_directories) if ($with_directories)
{ {
eval SET @aux = let $partitioning=
'PARTITION BY HASH(f_int1) PARTITIONS 2 PARTITION BY HASH(f_int1) PARTITIONS 2
(PARTITION p1 (PARTITION p1
$index_directory, $index_directory,
PARTITION p2 PARTITION p2
$index_directory)'; $index_directory);
let $partitioning= `SELECT @aux`;
} }
} }
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t1 ( eval CREATE TABLE t1 (
$column_list $column_list
$unique $unique
) )
$partitioning; $partitioning;
--enable_query_log
eval $insert_all; eval $insert_all;
--source suite/parts/inc/partition_check.inc --source suite/parts/inc/partition_check.inc
DROP TABLE t1; DROP TABLE t1;
--source suite/parts/inc/partition_check_drop.inc --source suite/parts/inc/partition_check_drop.inc
#----------- PARTITION BY KEY #----------- PARTITION BY KEY
--disable_query_log
if ($with_partitioning) if ($with_partitioning)
{ {
eval SET @aux = let $partitioning= PARTITION BY KEY(f_int1) PARTITIONS 5;
'PARTITION BY KEY(f_int1) PARTITIONS 5';
let $partitioning= `SELECT @aux`;
if ($with_directories) if ($with_directories)
{ {
--disable_query_log let $partitioning=
eval SET @aux = PARTITION BY HASH(f_int1) PARTITIONS 5
'PARTITION BY HASH(f_int1) PARTITIONS 5
(PARTITION p1 (PARTITION p1
$data_directory, $data_directory,
PARTITION p2 PARTITION p2
...@@ -73,27 +67,25 @@ $data_directory ...@@ -73,27 +67,25 @@ $data_directory
$index_directory, $index_directory,
PARTITION p4, PARTITION p4,
PARTITION p5 PARTITION p5
$index_directory)'; $index_directory);
let $partitioning= `SELECT @aux`;
} }
} }
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t1 ( eval CREATE TABLE t1 (
$column_list $column_list
$unique $unique
) )
$partitioning; $partitioning;
--enable_query_log
eval $insert_all; eval $insert_all;
--source suite/parts/inc/partition_check.inc --source suite/parts/inc/partition_check.inc
DROP TABLE t1; DROP TABLE t1;
--source suite/parts/inc/partition_check_drop.inc --source suite/parts/inc/partition_check_drop.inc
#----------- PARTITION BY LIST #----------- PARTITION BY LIST
--disable_query_log
if ($with_partitioning) if ($with_partitioning)
{ {
eval SET @aux = let $partitioning=
'PARTITION BY LIST(MOD(f_int1,4)) PARTITION BY LIST(MOD(f_int1,4))
(PARTITION part_3 VALUES IN (-3) (PARTITION part_3 VALUES IN (-3)
$index_directory, $index_directory,
PARTITION part_2 VALUES IN (-2) PARTITION part_2 VALUES IN (-2)
...@@ -109,25 +101,23 @@ $index_directory, ...@@ -109,25 +101,23 @@ $index_directory,
PARTITION part2 VALUES IN (2) PARTITION part2 VALUES IN (2)
$data_directory, $data_directory,
PARTITION part3 VALUES IN (3) PARTITION part3 VALUES IN (3)
$data_directory $index_directory)'; $data_directory $index_directory);
let $partitioning= `SELECT @aux`;
} }
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t1 ( eval CREATE TABLE t1 (
$column_list $column_list
$unique $unique
) )
$partitioning; $partitioning;
--enable_query_log
eval $insert_all; eval $insert_all;
--source suite/parts/inc/partition_check.inc --source suite/parts/inc/partition_check.inc
DROP TABLE t1; DROP TABLE t1;
--source suite/parts/inc/partition_check_drop.inc --source suite/parts/inc/partition_check_drop.inc
#----------- PARTITION BY RANGE #----------- PARTITION BY RANGE
--disable_query_log
if ($with_partitioning) if ($with_partitioning)
{ {
eval SET @aux = 'PARTITION BY RANGE(f_int1) let $partitioning= PARTITION BY RANGE(f_int1)
(PARTITION parta VALUES LESS THAN (0) (PARTITION parta VALUES LESS THAN (0)
$index_directory, $index_directory,
PARTITION partb VALUES LESS THAN ($max_row_div4) PARTITION partb VALUES LESS THAN ($max_row_div4)
...@@ -139,26 +129,24 @@ PARTITION partd VALUES LESS THAN ($max_row_div2 + $max_row_div4), ...@@ -139,26 +129,24 @@ PARTITION partd VALUES LESS THAN ($max_row_div2 + $max_row_div4),
PARTITION parte VALUES LESS THAN ($max_row) PARTITION parte VALUES LESS THAN ($max_row)
$data_directory, $data_directory,
PARTITION partf VALUES LESS THAN $MAX_VALUE PARTITION partf VALUES LESS THAN $MAX_VALUE
$index_directory)'; $index_directory);
let $partitioning= `SELECT @aux`;
} }
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t1 ( eval CREATE TABLE t1 (
$column_list $column_list
$unique $unique
) )
$partitioning; $partitioning;
--enable_query_log
eval $insert_all; eval $insert_all;
--source suite/parts/inc/partition_check.inc --source suite/parts/inc/partition_check.inc
DROP TABLE t1; DROP TABLE t1;
--source suite/parts/inc/partition_check_drop.inc --source suite/parts/inc/partition_check_drop.inc
#----------- PARTITION BY RANGE -- SUBPARTITION BY HASH #----------- PARTITION BY RANGE -- SUBPARTITION BY HASH
--disable_query_log
if ($with_partitioning) if ($with_partitioning)
{ {
eval SET @aux = let $partitioning=
'PARTITION BY RANGE(f_int1 DIV 2) SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 2 PARTITION BY RANGE(f_int1 DIV 2) SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 2
(PARTITION parta VALUES LESS THAN (0) (PARTITION parta VALUES LESS THAN (0)
$index_directory, $index_directory,
PARTITION partb VALUES LESS THAN ($max_row_div4) PARTITION partb VALUES LESS THAN ($max_row_div4)
...@@ -166,25 +154,23 @@ $data_directory, ...@@ -166,25 +154,23 @@ $data_directory,
PARTITION partc VALUES LESS THAN ($max_row_div2), PARTITION partc VALUES LESS THAN ($max_row_div2),
PARTITION partd VALUES LESS THAN $MAX_VALUE PARTITION partd VALUES LESS THAN $MAX_VALUE
$data_directory $data_directory
$index_directory)'; $index_directory);
let $partitioning= `SELECT @aux`;
} }
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t1 ( eval CREATE TABLE t1 (
$column_list $column_list
$unique $unique
) )
$partitioning; $partitioning;
--enable_query_log
eval $insert_all; eval $insert_all;
--source suite/parts/inc/partition_check.inc --source suite/parts/inc/partition_check.inc
DROP TABLE t1; DROP TABLE t1;
--source suite/parts/inc/partition_check_drop.inc --source suite/parts/inc/partition_check_drop.inc
#----------- PARTITION BY RANGE -- SUBPARTITION BY KEY #----------- PARTITION BY RANGE -- SUBPARTITION BY KEY
--disable_query_log
if ($with_partitioning) if ($with_partitioning)
{ {
eval SET @aux = 'PARTITION BY RANGE(f_int1) SUBPARTITION BY KEY(f_int1) let $partitioning= PARTITION BY RANGE(f_int1) SUBPARTITION BY KEY(f_int1)
(PARTITION part1 VALUES LESS THAN (0) (PARTITION part1 VALUES LESS THAN (0)
$data_directory $data_directory
(SUBPARTITION subpart11, SUBPARTITION subpart12), (SUBPARTITION subpart11, SUBPARTITION subpart12),
...@@ -196,26 +182,24 @@ $data_directory ...@@ -196,26 +182,24 @@ $data_directory
$index_directory $index_directory
(SUBPARTITION subpart31, SUBPARTITION subpart32), (SUBPARTITION subpart31, SUBPARTITION subpart32),
PARTITION part4 VALUES LESS THAN $MAX_VALUE PARTITION part4 VALUES LESS THAN $MAX_VALUE
(SUBPARTITION subpart41, SUBPARTITION subpart42))'; (SUBPARTITION subpart41, SUBPARTITION subpart42));
let $partitioning= `SELECT @aux`;
} }
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t1 ( eval CREATE TABLE t1 (
$column_list $column_list
$unique $unique
) )
$partitioning; $partitioning;
--enable_query_log
eval $insert_all; eval $insert_all;
--source suite/parts/inc/partition_check.inc --source suite/parts/inc/partition_check.inc
DROP TABLE t1; DROP TABLE t1;
--source suite/parts/inc/partition_check_drop.inc --source suite/parts/inc/partition_check_drop.inc
#----------- PARTITION BY LIST -- SUBPARTITION BY HASH #----------- PARTITION BY LIST -- SUBPARTITION BY HASH
--disable_query_log
if ($with_partitioning) if ($with_partitioning)
{ {
eval SET @aux = let $partitioning=
'PARTITION BY LIST(ABS(MOD(f_int1,3))) SUBPARTITION BY HASH(f_int1 + 1) PARTITION BY LIST(ABS(MOD(f_int1,3))) SUBPARTITION BY HASH(f_int1 + 1)
(PARTITION part1 VALUES IN (0) (PARTITION part1 VALUES IN (0)
$index_directory $index_directory
(SUBPARTITION sp11 (SUBPARTITION sp11
...@@ -239,15 +223,14 @@ eval SET @aux = ...@@ -239,15 +223,14 @@ eval SET @aux =
$index_directory, $index_directory,
SUBPARTITION sp42 SUBPARTITION sp42
$data_directory $data_directory
$index_directory))'; $index_directory));
let $partitioning= `SELECT @aux`;
} }
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t1 ( eval CREATE TABLE t1 (
$column_list $column_list
$unique $unique
) )
$partitioning; $partitioning;
--enable_query_log
eval $insert_all; eval $insert_all;
--source suite/parts/inc/partition_check.inc --source suite/parts/inc/partition_check.inc
DROP TABLE t1; DROP TABLE t1;
......
--disable_query_log
# DATA DIRECTORY
eval SET @data_dir = 'DATA DIRECTORY =
''/tmp''';
let $data_directory = `select @data_dir`;
#INDEX DIRECTORY
eval SET @indx_dir = 'INDEX DIRECTORY =
''/tmp''';
let $index_directory = `select @indx_dir`;
--enable_query_log
eval create table t1 (a double not null, primary key(a)) engine=$engine eval create table t1 (a double not null, primary key(a)) engine=$engine
partition by key (a) ( partition by key (a) (
partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, partition pa1 max_rows=20 min_rows=2,
partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, partition pa2 max_rows=30 min_rows=3,
partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, partition pa3 max_rows=30 min_rows=4,
partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
show create table t1; show create table t1;
insert into t1 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208); insert into t1 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208);
select * from t1; select * from t1;
......
...@@ -83,6 +83,7 @@ DROP TABLE t1; ...@@ -83,6 +83,7 @@ DROP TABLE t1;
--echo # 3 Some but not all named partitions or subpartitions get a storage --echo # 3 Some but not all named partitions or subpartitions get a storage
--echo # engine assigned --echo # engine assigned
--echo #------------------------------------------------------------------------ --echo #------------------------------------------------------------------------
--error ER_MIX_HANDLER_ERROR
eval CREATE TABLE t1 ( eval CREATE TABLE t1 (
$column_list $column_list
) )
...@@ -90,10 +91,7 @@ PARTITION BY HASH(f_int1) ...@@ -90,10 +91,7 @@ PARTITION BY HASH(f_int1)
( PARTITION part1 STORAGE ENGINE = $engine, ( PARTITION part1 STORAGE ENGINE = $engine,
PARTITION part2 PARTITION part2
); );
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) --error ER_MIX_HANDLER_ERROR
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
--source suite/parts/inc/partition_check.inc
DROP TABLE t1;
eval CREATE TABLE t1 ( eval CREATE TABLE t1 (
$column_list $column_list
) )
...@@ -101,10 +99,7 @@ PARTITION BY HASH(f_int1) ...@@ -101,10 +99,7 @@ PARTITION BY HASH(f_int1)
( PARTITION part1 , ( PARTITION part1 ,
PARTITION part2 STORAGE ENGINE = $engine PARTITION part2 STORAGE ENGINE = $engine
); );
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) --error ER_MIX_HANDLER_ERROR
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
--source suite/parts/inc/partition_check.inc
DROP TABLE t1;
eval CREATE TABLE t1 ( eval CREATE TABLE t1 (
$column_list $column_list
) )
...@@ -117,10 +112,7 @@ SUBPARTITION BY HASH(f_int1) ...@@ -117,10 +112,7 @@ SUBPARTITION BY HASH(f_int1)
(SUBPARTITION subpart21 STORAGE ENGINE = $engine, (SUBPARTITION subpart21 STORAGE ENGINE = $engine,
SUBPARTITION subpart22 STORAGE ENGINE = $engine) SUBPARTITION subpart22 STORAGE ENGINE = $engine)
); );
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) --error ER_MIX_HANDLER_ERROR
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
--source suite/parts/inc/partition_check.inc
DROP TABLE t1;
eval CREATE TABLE t1 ( eval CREATE TABLE t1 (
$column_list $column_list
) )
...@@ -133,6 +125,19 @@ SUBPARTITION BY HASH(f_int1) ...@@ -133,6 +125,19 @@ SUBPARTITION BY HASH(f_int1)
(SUBPARTITION subpart21, (SUBPARTITION subpart21,
SUBPARTITION subpart22 ) SUBPARTITION subpart22 )
); );
eval CREATE TABLE t1 (
$column_list
)
ENGINE = $engine
PARTITION BY RANGE(f_int1)
SUBPARTITION BY HASH(f_int1)
( PARTITION part1 VALUES LESS THAN ($max_row_div2)
(SUBPARTITION subpart11 STORAGE ENGINE = $engine,
SUBPARTITION subpart12 STORAGE ENGINE = $engine),
PARTITION part2 VALUES LESS THAN $MAX_VALUE
(SUBPARTITION subpart21,
SUBPARTITION subpart22 )
);
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
--source suite/parts/inc/partition_check.inc --source suite/parts/inc/partition_check.inc
...@@ -142,6 +147,33 @@ DROP TABLE t1; ...@@ -142,6 +147,33 @@ DROP TABLE t1;
--echo # 4 Storage engine assignment after partition name + after name of --echo # 4 Storage engine assignment after partition name + after name of
--echo # subpartitions belonging to another partition --echo # subpartitions belonging to another partition
--echo #------------------------------------------------------------------------ --echo #------------------------------------------------------------------------
--error ER_MIX_HANDLER_ERROR
eval CREATE TABLE t1 (
$column_list
)
PARTITION BY RANGE(f_int1)
SUBPARTITION BY HASH(f_int1)
( PARTITION part1 VALUES LESS THAN ($max_row_div2)
(SUBPARTITION subpart11,
SUBPARTITION subpart12),
PARTITION part2 VALUES LESS THAN $MAX_VALUE
(SUBPARTITION subpart21 STORAGE ENGINE = $engine,
SUBPARTITION subpart22 STORAGE ENGINE = $engine)
);
eval CREATE TABLE t1 (
$column_list
)
ENGINE = $engine
PARTITION BY RANGE(f_int1)
SUBPARTITION BY HASH(f_int1)
( PARTITION part1 VALUES LESS THAN ($max_row_div2) ENGINE = $engine
(SUBPARTITION subpart11,
SUBPARTITION subpart12),
PARTITION part2 VALUES LESS THAN $MAX_VALUE
(SUBPARTITION subpart21,
SUBPARTITION subpart22 STORAGE ENGINE = $engine)
);
DROP TABLE t1;
eval CREATE TABLE t1 ( eval CREATE TABLE t1 (
$column_list $column_list
) )
...@@ -167,7 +199,7 @@ SUBPARTITION BY HASH(f_int1) ...@@ -167,7 +199,7 @@ SUBPARTITION BY HASH(f_int1)
(SUBPARTITION subpart11 STORAGE ENGINE = $engine, (SUBPARTITION subpart11 STORAGE ENGINE = $engine,
SUBPARTITION subpart12 STORAGE ENGINE = $engine), SUBPARTITION subpart12 STORAGE ENGINE = $engine),
PARTITION part2 VALUES LESS THAN $MAX_VALUE ENGINE = $engine PARTITION part2 VALUES LESS THAN $MAX_VALUE ENGINE = $engine
(SUBPARTITION subpart21, (SUBPARTITION subpart21 ENGINE = $engine,
SUBPARTITION subpart22) SUBPARTITION subpart22)
); );
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
...@@ -209,7 +241,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; ...@@ -209,7 +241,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
DROP TABLE t1; DROP TABLE t1;
--echo # 6.2 Storage engine assignment after partition name + after --echo # 6.2 Storage engine assignment after partition name + after
--echo # subpartition name --echo # subpartition name
# in partition part + in sub partition part --echo # in partition part + in sub partition part
eval CREATE TABLE t1 ( eval CREATE TABLE t1 (
$column_list $column_list
) )
......
--echo ---- Partitioning and enum data type --echo ---- Partitioning and enum data type
--disable_query_log
# DATA DIRECTORY
eval SET @data_dir = 'DATA DIRECTORY =
''/tmp''';
let $data_directory = `select @data_dir`;
#INDEX DIRECTORY
eval SET @indx_dir = 'INDEX DIRECTORY =
''/tmp''';
let $index_directory = `select @indx_dir`;
--enable_query_log
eval create table t1 (a enum('A','B','C','D','E','F','G','H','I','J','K','L') not null, primary key(a)) engine=$engine eval create table t1 (a enum('A','B','C','D','E','F','G','H','I','J','K','L') not null, primary key(a)) engine=$engine
partition by key (a) ( partition by key (a) (
partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, partition pa1 max_rows=20 min_rows=2,
partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, partition pa2 max_rows=30 min_rows=3,
partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, partition pa3 max_rows=30 min_rows=4,
partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
show create table t1; show create table t1;
insert into t1 values ('A'),('D'),('L'),('G'); insert into t1 values ('A'),('D'),('L'),('G');
select * from t1; select * from t1;
......
--disable_query_log
# DATA DIRECTORY
eval SET @data_dir = 'DATA DIRECTORY =
''/tmp''';
let $data_directory = `select @data_dir`;
#INDEX DIRECTORY
eval SET @indx_dir = 'INDEX DIRECTORY =
''/tmp''';
let $index_directory = `select @indx_dir`;
--enable_query_log
eval create table t1 (a float not null, primary key(a)) engine=$engine eval create table t1 (a float not null, primary key(a)) engine=$engine
partition by key (a) ( partition by key (a) (
partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, partition pa1 max_rows=20 min_rows=2,
partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, partition pa2 max_rows=30 min_rows=3,
partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, partition pa3 max_rows=30 min_rows=4,
partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
show create table t1; show create table t1;
insert into t1 values (-3.402823466E+38), (3.402823466E+38), (-1.5), (-1), (0), (1), (1.5); insert into t1 values (-3.402823466E+38), (3.402823466E+38), (-1.5), (-1), (0), (1), (1.5);
select * from t1; select * from t1;
......
--disable_query_log
# DATA DIRECTORY
eval SET @data_dir = 'DATA DIRECTORY =
''/tmp''';
let $data_directory = `select @data_dir`;
#INDEX DIRECTORY
eval SET @indx_dir = 'INDEX DIRECTORY =
''/tmp''';
let $index_directory = `select @indx_dir`;
--enable_query_log
eval create table t1 (a int unsigned not null, primary key(a)) engine=$engine eval create table t1 (a int unsigned not null, primary key(a)) engine=$engine
partition by key (a) ( partition by key (a) (
partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, partition pa1 max_rows=20 min_rows=2,
partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, partition pa2 max_rows=30 min_rows=3,
partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, partition pa3 max_rows=30 min_rows=4,
partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
show create table t1; show create table t1;
insert into t1 values (4294967295), (4294967294), (4294967293), (4294967292), (1), (2), (65535); insert into t1 values (4294967295), (4294967294), (4294967293), (4294967292), (1), (2), (65535);
select * from t1; select * from t1;
......
--disable_query_log
# DATA DIRECTORY
eval SET @data_dir = 'DATA DIRECTORY =
''/tmp''';
let $data_directory = `select @data_dir`;
#INDEX DIRECTORY
eval SET @indx_dir = 'INDEX DIRECTORY =
''/tmp''';
let $index_directory = `select @indx_dir`;
--enable_query_log
eval create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, a1 date not null, b1 varchar(50) not null, c1 varchar(50) not null, d1 enum('m', 'w') not null, e1 int not null, f1 decimal (18,2) not null, g1 bigint not null, h1 tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1)) engine=$engine eval create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, a1 date not null, b1 varchar(50) not null, c1 varchar(50) not null, d1 enum('m', 'w') not null, e1 int not null, f1 decimal (18,2) not null, g1 bigint not null, h1 tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1)) engine=$engine
partition by key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1) ( partition by key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1) (
partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, partition pa1 max_rows=20 min_rows=2,
partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, partition pa2 max_rows=30 min_rows=3,
partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, partition pa3 max_rows=30 min_rows=4,
partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
show create table t1; show create table t1;
insert into t1 values insert into t1 values
('1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113,'1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113, 'tbhth nrzh ztfghgfh fzh ftzhj fztjh'), ('1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113,'1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113, 'tbhth nrzh ztfghgfh fzh ftzhj fztjh'),
......
--disable_query_log
# DATA DIRECTORY
eval SET @data_dir = 'DATA DIRECTORY =
''/tmp''';
let $data_directory = `select @data_dir`;
#INDEX DIRECTORY
eval SET @indx_dir = 'INDEX DIRECTORY =
''/tmp''';
let $index_directory = `select @indx_dir`;
--enable_query_log
--error ER_TOO_MANY_KEY_PARTS --error ER_TOO_MANY_KEY_PARTS
eval create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, a1 date not null, b1 varchar(50) not null, c1 varchar(50) not null, d1 enum('m', 'w') not null, e1 int not null, f1 decimal (18,2) not null, g1 bigint not null, h1 tinyint not null, a2 date not null, b2 varchar(50) not null, c2 varchar(50) not null, d2 enum('m', 'w') not null, e2 int not null, f2 decimal (18,2) not null, g2 bigint not null, h2 tinyint not null, a3 date not null, b3 varchar(50) not null, c3 varchar(50) not null, d3 enum('m', 'w') not null, e3 int not null, f3 decimal (18,2) not null, g3 bigint not null, h3 tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1,a2,b2,c2,d2,e2,f2,g2,h2,a3,b3,c3,d3,e3,f3,g3,h3)) engine=$engine eval create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, a1 date not null, b1 varchar(50) not null, c1 varchar(50) not null, d1 enum('m', 'w') not null, e1 int not null, f1 decimal (18,2) not null, g1 bigint not null, h1 tinyint not null, a2 date not null, b2 varchar(50) not null, c2 varchar(50) not null, d2 enum('m', 'w') not null, e2 int not null, f2 decimal (18,2) not null, g2 bigint not null, h2 tinyint not null, a3 date not null, b3 varchar(50) not null, c3 varchar(50) not null, d3 enum('m', 'w') not null, e3 int not null, f3 decimal (18,2) not null, g3 bigint not null, h3 tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1,a2,b2,c2,d2,e2,f2,g2,h2,a3,b3,c3,d3,e3,f3,g3,h3)) engine=$engine
partition by key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1,a2,b2,c2,d2,e2,f2,g2,h2,a3,b3,c3,d3,e3,f3,g3,h3) ( partition by key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1,a2,b2,c2,d2,e2,f2,g2,h2,a3,b3,c3,d3,e3,f3,g3,h3) (
partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, partition pa1 max_rows=20 min_rows=2,
partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, partition pa2 max_rows=30 min_rows=3,
partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, partition pa3 max_rows=30 min_rows=4,
partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
eval create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, a1 date not null, b1 varchar(50) not null, c1 varchar(50) not null, d1 enum('m', 'w') not null, e1 int not null, f1 decimal (18,2) not null, g1 bigint not null, h1 tinyint not null, a2 date not null, b2 varchar(50) not null, c2 varchar(50) not null, d2 enum('m', 'w') not null, e2 int not null, f2 decimal (18,2) not null, g2 bigint not null, h2 tinyint not null, a3 date not null, b3 varchar(50) not null, c3 varchar(50) not null, d3 enum('m', 'w') not null, e3 int not null, f3 decimal (18,2) not null, g3 bigint not null, h3 tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1)) engine=$engine eval create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, a1 date not null, b1 varchar(50) not null, c1 varchar(50) not null, d1 enum('m', 'w') not null, e1 int not null, f1 decimal (18,2) not null, g1 bigint not null, h1 tinyint not null, a2 date not null, b2 varchar(50) not null, c2 varchar(50) not null, d2 enum('m', 'w') not null, e2 int not null, f2 decimal (18,2) not null, g2 bigint not null, h2 tinyint not null, a3 date not null, b3 varchar(50) not null, c3 varchar(50) not null, d3 enum('m', 'w') not null, e3 int not null, f3 decimal (18,2) not null, g3 bigint not null, h3 tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1)) engine=$engine
partition by key(a,b,c,d,e,f,g,h) ( partition by key(a,b,c,d,e,f,g,h) (
partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, partition pa1 max_rows=20 min_rows=2,
partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, partition pa2 max_rows=30 min_rows=3,
partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, partition pa3 max_rows=30 min_rows=4,
partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
--disable_abort_on error --disable_abort_on error
show create table t1; show create table t1;
......
--disable_query_log
# DATA DIRECTORY
eval SET @data_dir = 'DATA DIRECTORY =
''/tmp''';
let $data_directory = `select @data_dir`;
#INDEX DIRECTORY
eval SET @indx_dir = 'INDEX DIRECTORY =
''/tmp''';
let $index_directory = `select @indx_dir`;
--enable_query_log
eval create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w'), primary key(a,b,c,d)) engine=$engine eval create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w'), primary key(a,b,c,d)) engine=$engine
partition by key (a,b,c,d) ( partition by key (a,b,c,d) (
partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, partition pa1 max_rows=20 min_rows=2,
partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, partition pa2 max_rows=30 min_rows=3,
partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, partition pa3 max_rows=30 min_rows=4,
partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
show create table t1; show create table t1;
insert into t1 values insert into t1 values
('1975-01-01', 'abcde', 'abcde','m'), ('1975-01-01', 'abcde', 'abcde','m'),
......
--disable_query_log
# DATA DIRECTORY
eval SET @data_dir = 'DATA DIRECTORY =
''/tmp''';
let $data_directory = `select @data_dir`;
#INDEX DIRECTORY
eval SET @indx_dir = 'INDEX DIRECTORY =
''/tmp''';
let $index_directory = `select @indx_dir`;
--enable_query_log
eval create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h)) engine=$engine eval create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h)) engine=$engine
partition by key(a,b,c,d,e,f,g,h) ( partition by key(a,b,c,d,e,f,g,h) (
partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, partition pa1 max_rows=20 min_rows=2,
partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, partition pa2 max_rows=30 min_rows=3,
partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, partition pa3 max_rows=30 min_rows=4,
partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
show create table t1; show create table t1;
insert into t1 values insert into t1 values
('1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113, 'tbhth nrzh ztfghgfh fzh ftzhj fztjh'), ('1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113, 'tbhth nrzh ztfghgfh fzh ftzhj fztjh'),
......
...@@ -38,7 +38,8 @@ if ($do_file_tests) ...@@ -38,7 +38,8 @@ if ($do_file_tests)
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1* > $MYSQLTEST_VARDIR/master-data/test/tmp2 2>&1 || true --exec ls $MYSQLTEST_VARDIR/master-data/test/t1* > $MYSQLTEST_VARDIR/master-data/test/tmp2 2>&1 || true
if ($with_directories) if ($with_directories)
{ {
--exec ls $MYSQLTEST_VARDIR/tmp/t1* >> $MYSQLTEST_VARDIR/master-data/test/tmp2 2>&1 || true --exec ls $MYSQLTEST_VARDIR/mysql-test-data-dir/t1* >> $MYSQLTEST_VARDIR/master-data/test/tmp2 2>&1 || true
--exec ls $MYSQLTEST_VARDIR/mysql-test-idx-dir/t1* >> $MYSQLTEST_VARDIR/master-data/test/tmp2 2>&1 || true
} }
eval SET @aux = CONCAT('load_file(''$MYSQLTEST_VARDIR','/master-data/test/tmp2'' eval SET @aux = CONCAT('load_file(''$MYSQLTEST_VARDIR','/master-data/test/tmp2''
)'); )');
......
...@@ -32,6 +32,11 @@ if ($do_file_tests) ...@@ -32,6 +32,11 @@ if ($do_file_tests)
{ {
# List the files belonging to the table t1 # List the files belonging to the table t1
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1* > $MYSQLTEST_VARDIR/master-data/test/tmp2 2>&1 || true --exec ls $MYSQLTEST_VARDIR/master-data/test/t1* > $MYSQLTEST_VARDIR/master-data/test/tmp2 2>&1 || true
if ($with_directories)
{
--exec ls $MYSQLTEST_VARDIR/mysql-test-data-dir/t1* >> $MYSQLTEST_VARDIR/master-data/test/tmp2 2>&1 || true
--exec ls $MYSQLTEST_VARDIR/mysql-test-idx-dir/t1* >> $MYSQLTEST_VARDIR/master-data/test/tmp2 2>&1 || true
}
eval SET @aux = CONCAT('load_file(''$MYSQLTEST_VARDIR','/master-data/test/tmp2'')'); eval SET @aux = CONCAT('load_file(''$MYSQLTEST_VARDIR','/master-data/test/tmp2'')');
let $file_list= `SELECT @aux`; let $file_list= `SELECT @aux`;
} }
......
--disable_query_log
# DATA DIRECTORY
eval SET @data_dir = 'DATA DIRECTORY =
''/tmp''';
let $data_directory = `select @data_dir`;
#INDEX DIRECTORY
eval SET @indx_dir = 'INDEX DIRECTORY =
''/tmp''';
let $index_directory = `select @indx_dir`;
--enable_query_log
eval create table t1 (a mediumint unsigned not null, primary key(a)) engine=$engine eval create table t1 (a mediumint unsigned not null, primary key(a)) engine=$engine
partition by key (a) ( partition by key (a) (
partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, partition pa1 max_rows=20 min_rows=2,
partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, partition pa2 max_rows=30 min_rows=3,
partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, partition pa3 max_rows=30 min_rows=4,
partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
show create table t1; show create table t1;
insert into t1 values (16777215), (16777214), (16777213), (16777212), (1), (2), (65535); insert into t1 values (16777215), (16777214), (16777213), (16777212), (1), (2), (65535);
select * from t1; select * from t1;
......
...@@ -44,42 +44,38 @@ let $partitioning= ; ...@@ -44,42 +44,38 @@ let $partitioning= ;
if ($with_partitioning) if ($with_partitioning)
{ {
let $partitioning= PARTITION BY HASH(f_int1) PARTITIONS 2; let $partitioning= PARTITION BY HASH(f_int1) PARTITIONS 2;
--disable_query_log
if ($with_directories) if ($with_directories)
{ {
eval SET @aux = let $partitioning=
'PARTITION BY HASH(f_int1) PARTITIONS 2 PARTITION BY HASH(f_int1) PARTITIONS 2
(PARTITION p1 (PARTITION p1
$data_directory $data_directory
$index_directory, $index_directory,
PARTITION p2 PARTITION p2
$data_directory $data_directory
$index_directory)'; $index_directory);
let $partitioning= `SELECT @aux`;
} }
} }
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t1 ( eval CREATE TABLE t1 (
$column_list $column_list
$unique $unique
) )
$partitioning; $partitioning;
--enable_query_log
eval $insert_all; eval $insert_all;
--source suite/parts/inc/partition_check.inc --source suite/parts/inc/partition_check.inc
DROP TABLE t1; DROP TABLE t1;
--source suite/parts/inc/partition_check_drop.inc --source suite/parts/inc/partition_check_drop.inc
#----------- PARTITION BY KEY #----------- PARTITION BY KEY
--disable_query_log
if ($with_partitioning) if ($with_partitioning)
{ {
eval SET @aux = let $partitioning=
'PARTITION BY KEY(f_int1) PARTITIONS 5'; PARTITION BY KEY(f_int1) PARTITIONS 5;
let $partitioning= `SELECT @aux`;
if ($with_directories) if ($with_directories)
{ {
eval SET @aux = let $partitioning=
'PARTITION BY HASH(f_int1) PARTITIONS 5 PARTITION BY KEY(f_int1) PARTITIONS 5
(PARTITION p1 (PARTITION p1
$data_directory $data_directory
$index_directory, $index_directory,
...@@ -94,27 +90,37 @@ $data_directory ...@@ -94,27 +90,37 @@ $data_directory
$index_directory, $index_directory,
PARTITION p5 PARTITION p5
$data_directory $data_directory
$index_directory)'; $index_directory);
let $partitioning= `SELECT @aux`;
} }
} }
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t1 ( eval CREATE TABLE t1 (
$column_list $column_list
$unique $unique
) )
$partitioning; $partitioning;
--enable_query_log
eval $insert_all; eval $insert_all;
--source suite/parts/inc/partition_check.inc --source suite/parts/inc/partition_check.inc
DROP TABLE t1; DROP TABLE t1;
--source suite/parts/inc/partition_check_drop.inc --source suite/parts/inc/partition_check_drop.inc
#----------- PARTITION BY LIST #----------- PARTITION BY LIST
--disable_query_log
if ($with_partitioning) if ($with_partitioning)
{ {
eval SET @aux = let $partitioning=
'PARTITION BY LIST(MOD(f_int1,4)) PARTITION BY LIST(MOD(f_int1,4))
(PARTITION part_3 VALUES IN (-3),
PARTITION part_2 VALUES IN (-2),
PARTITION part_1 VALUES IN (-1),
PARTITION part_N VALUES IN (NULL),
PARTITION part0 VALUES IN (0),
PARTITION part1 VALUES IN (1),
PARTITION part2 VALUES IN (2),
PARTITION part3 VALUES IN (3));
if ($with_directories)
{
let $partitioning=
PARTITION BY LIST(MOD(f_int1,4))
(PARTITION part_3 VALUES IN (-3) (PARTITION part_3 VALUES IN (-3)
$data_directory $index_directory, $data_directory $index_directory,
PARTITION part_2 VALUES IN (-2) PARTITION part_2 VALUES IN (-2)
...@@ -130,25 +136,33 @@ $data_directory $index_directory, ...@@ -130,25 +136,33 @@ $data_directory $index_directory,
PARTITION part2 VALUES IN (2) PARTITION part2 VALUES IN (2)
$data_directory $index_directory, $data_directory $index_directory,
PARTITION part3 VALUES IN (3) PARTITION part3 VALUES IN (3)
$data_directory $index_directory)'; $data_directory $index_directory);
let $partitioning= `SELECT @aux`; }
} }
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t1 ( eval CREATE TABLE t1 (
$column_list $column_list
$unique $unique
) )
$partitioning; $partitioning;
--enable_query_log
eval $insert_all; eval $insert_all;
--source suite/parts/inc/partition_check.inc --source suite/parts/inc/partition_check.inc
DROP TABLE t1; DROP TABLE t1;
--source suite/parts/inc/partition_check_drop.inc --source suite/parts/inc/partition_check_drop.inc
#----------- PARTITION BY RANGE #----------- PARTITION BY RANGE
--disable_query_log
if ($with_partitioning) if ($with_partitioning)
{ {
eval SET @aux = 'PARTITION BY RANGE(f_int1) let $partitioning= PARTITION BY RANGE(f_int1)
(PARTITION parta VALUES LESS THAN (0),
PARTITION partb VALUES LESS THAN ($max_row_div4),
PARTITION partc VALUES LESS THAN ($max_row_div2),
PARTITION partd VALUES LESS THAN ($max_row_div2 + $max_row_div4),
PARTITION parte VALUES LESS THAN ($max_row),
PARTITION partf VALUES LESS THAN $MAX_VALUE);
if ($with_directories)
{
let $partitioning= PARTITION BY RANGE(f_int1)
(PARTITION parta VALUES LESS THAN (0) (PARTITION parta VALUES LESS THAN (0)
$data_directory $data_directory
$index_directory, $index_directory,
...@@ -166,26 +180,33 @@ $data_directory ...@@ -166,26 +180,33 @@ $data_directory
$index_directory, $index_directory,
PARTITION partf VALUES LESS THAN $MAX_VALUE PARTITION partf VALUES LESS THAN $MAX_VALUE
$data_directory $data_directory
$index_directory)'; $index_directory);
let $partitioning= `SELECT @aux`;
} }
}
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t1 ( eval CREATE TABLE t1 (
$column_list $column_list
$unique $unique
) )
$partitioning; $partitioning;
--enable_query_log
eval $insert_all; eval $insert_all;
--source suite/parts/inc/partition_check.inc --source suite/parts/inc/partition_check.inc
DROP TABLE t1; DROP TABLE t1;
--source suite/parts/inc/partition_check_drop.inc --source suite/parts/inc/partition_check_drop.inc
#----------- PARTITION BY RANGE -- SUBPARTITION BY HASH #----------- PARTITION BY RANGE -- SUBPARTITION BY HASH
--disable_query_log
if ($with_partitioning) if ($with_partitioning)
{ {
eval SET @aux = let $partitioning=
'PARTITION BY RANGE(f_int1 DIV 2) SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 2 PARTITION BY RANGE(f_int1 DIV 2) SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 2
(PARTITION parta VALUES LESS THAN (0),
PARTITION partb VALUES LESS THAN ($max_row_div4),
PARTITION partc VALUES LESS THAN ($max_row_div2),
PARTITION partd VALUES LESS THAN $MAX_VALUE);
if ($with_directories)
{
let $partitioning=
PARTITION BY RANGE(f_int1 DIV 2) SUBPARTITION BY HASH(f_int1) SUBPARTITIONS 2
(PARTITION parta VALUES LESS THAN (0) (PARTITION parta VALUES LESS THAN (0)
$data_directory $data_directory
$index_directory, $index_directory,
...@@ -197,60 +218,81 @@ $data_directory ...@@ -197,60 +218,81 @@ $data_directory
$index_directory, $index_directory,
PARTITION partd VALUES LESS THAN $MAX_VALUE PARTITION partd VALUES LESS THAN $MAX_VALUE
$data_directory $data_directory
$index_directory)'; $index_directory);
let $partitioning= `SELECT @aux`; }
} }
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t1 ( eval CREATE TABLE t1 (
$column_list $column_list
$unique $unique
) )
$partitioning; $partitioning;
--enable_query_log
eval $insert_all; eval $insert_all;
--source suite/parts/inc/partition_check.inc --source suite/parts/inc/partition_check.inc
DROP TABLE t1; DROP TABLE t1;
--source suite/parts/inc/partition_check_drop.inc --source suite/parts/inc/partition_check_drop.inc
#----------- PARTITION BY RANGE -- SUBPARTITION BY KEY #----------- PARTITION BY RANGE -- SUBPARTITION BY KEY
--disable_query_log
if ($with_partitioning) if ($with_partitioning)
{ {
eval SET @aux = 'PARTITION BY RANGE(f_int1) SUBPARTITION BY KEY(f_int1) let $partitioning= PARTITION BY RANGE(f_int1) SUBPARTITION BY KEY(f_int1)
(PARTITION part1 VALUES LESS THAN (0) (PARTITION part1 VALUES LESS THAN (0)
$data_directory
$index_directory
(SUBPARTITION subpart11, SUBPARTITION subpart12), (SUBPARTITION subpart11, SUBPARTITION subpart12),
PARTITION part2 VALUES LESS THAN ($max_row_div4) PARTITION part2 VALUES LESS THAN ($max_row_div4)
$data_directory
$index_directory
(SUBPARTITION subpart21, SUBPARTITION subpart22), (SUBPARTITION subpart21, SUBPARTITION subpart22),
PARTITION part3 VALUES LESS THAN ($max_row_div2) PARTITION part3 VALUES LESS THAN ($max_row_div2)
$data_directory
$index_directory
(SUBPARTITION subpart31, SUBPARTITION subpart32), (SUBPARTITION subpart31, SUBPARTITION subpart32),
PARTITION part4 VALUES LESS THAN $MAX_VALUE PARTITION part4 VALUES LESS THAN $MAX_VALUE
$data_directory (SUBPARTITION subpart41, SUBPARTITION subpart42));
$index_directory if ($with_directories)
(SUBPARTITION subpart41, SUBPARTITION subpart42))'; {
let $partitioning= `SELECT @aux`; let $partitioning= PARTITION BY RANGE(f_int1) SUBPARTITION BY KEY(f_int1)
(PARTITION part1 VALUES LESS THAN (0)
(SUBPARTITION subpart11 $data_directory $index_directory,
SUBPARTITION subpart12 $data_directory $index_directory),
PARTITION part2 VALUES LESS THAN ($max_row_div4)
(SUBPARTITION subpart21 $data_directory $index_directory,
SUBPARTITION subpart22 $data_directory $index_directory),
PARTITION part3 VALUES LESS THAN ($max_row_div2)
(SUBPARTITION subpart31 $data_directory $index_directory,
SUBPARTITION subpart32 $data_directory $index_directory),
PARTITION part4 VALUES LESS THAN $MAX_VALUE
(SUBPARTITION subpart41 $data_directory $index_directory,
SUBPARTITION subpart42 $data_directory $index_directory));
} }
}
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t1 ( eval CREATE TABLE t1 (
$column_list $column_list
$unique $unique
) )
$partitioning; $partitioning;
--enable_query_log
eval $insert_all; eval $insert_all;
--source suite/parts/inc/partition_check.inc --source suite/parts/inc/partition_check.inc
DROP TABLE t1; DROP TABLE t1;
--source suite/parts/inc/partition_check_drop.inc --source suite/parts/inc/partition_check_drop.inc
#----------- PARTITION BY LIST -- SUBPARTITION BY HASH #----------- PARTITION BY LIST -- SUBPARTITION BY HASH
--disable_query_log
if ($with_partitioning) if ($with_partitioning)
{ {
eval SET @aux = let $partitioning=
'PARTITION BY LIST(ABS(MOD(f_int1,3))) SUBPARTITION BY HASH(f_int1 + 1) PARTITION BY LIST(ABS(MOD(f_int1,3))) SUBPARTITION BY HASH(f_int1 + 1)
(PARTITION part1 VALUES IN (0)
(SUBPARTITION sp11,
SUBPARTITION sp12),
PARTITION part2 VALUES IN (1)
(SUBPARTITION sp21,
SUBPARTITION sp22),
PARTITION part3 VALUES IN (2)
(SUBPARTITION sp31,
SUBPARTITION sp32),
PARTITION part4 VALUES IN (NULL)
(SUBPARTITION sp41,
SUBPARTITION sp42));
if ($with_directories)
{
let $partitioning=
PARTITION BY LIST(ABS(MOD(f_int1,3))) SUBPARTITION BY HASH(f_int1 + 1)
(PARTITION part1 VALUES IN (0) (PARTITION part1 VALUES IN (0)
$data_directory $data_directory
$index_directory $index_directory
...@@ -282,26 +324,33 @@ eval SET @aux = ...@@ -282,26 +324,33 @@ eval SET @aux =
$index_directory, $index_directory,
SUBPARTITION sp42 SUBPARTITION sp42
$data_directory $data_directory
$index_directory))'; $index_directory));
let $partitioning= `SELECT @aux`; }
} }
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t1 ( eval CREATE TABLE t1 (
$column_list $column_list
$unique $unique
) )
$partitioning; $partitioning;
--enable_query_log
eval $insert_all; eval $insert_all;
--source suite/parts/inc/partition_check.inc --source suite/parts/inc/partition_check.inc
DROP TABLE t1; DROP TABLE t1;
--source suite/parts/inc/partition_check_drop.inc --source suite/parts/inc/partition_check_drop.inc
#----------- PARTITION BY LIST -- SUBPARTITION BY KEY #----------- PARTITION BY LIST -- SUBPARTITION BY KEY
--disable_query_log
if ($with_partitioning) if ($with_partitioning)
{ {
eval SET @aux = let $partitioning=
'PARTITION BY LIST(ABS(MOD(f_int1,2))) PARTITION BY LIST(ABS(MOD(f_int1,2)))
SUBPARTITION BY KEY(f_int1) SUBPARTITIONS $sub_part_no
(PARTITION part1 VALUES IN (0),
PARTITION part2 VALUES IN (1),
PARTITION part3 VALUES IN (NULL));
if ($with_directories)
{
let $partitioning=
PARTITION BY LIST(ABS(MOD(f_int1,2)))
SUBPARTITION BY KEY(f_int1) SUBPARTITIONS $sub_part_no SUBPARTITION BY KEY(f_int1) SUBPARTITIONS $sub_part_no
(PARTITION part1 VALUES IN (0) (PARTITION part1 VALUES IN (0)
$data_directory $data_directory
...@@ -311,17 +360,16 @@ SUBPARTITION BY KEY(f_int1) SUBPARTITIONS $sub_part_no ...@@ -311,17 +360,16 @@ SUBPARTITION BY KEY(f_int1) SUBPARTITIONS $sub_part_no
$index_directory, $index_directory,
PARTITION part3 VALUES IN (NULL) PARTITION part3 VALUES IN (NULL)
$data_directory $data_directory
$index_directory)'; $index_directory);
let $partitioning= `SELECT @aux`; }
} }
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t1 ( eval CREATE TABLE t1 (
$column_list $column_list
$unique $unique
) )
$partitioning; $partitioning;
--enable_query_log
eval $insert_all; eval $insert_all;
--source suite/parts/inc/partition_check.inc --source suite/parts/inc/partition_check.inc
DROP TABLE t1; DROP TABLE t1;
--source suite/parts/inc/partition_check_drop.inc --source suite/parts/inc/partition_check_drop.inc
let $with_directories= FALSE;
--echo ---- Partitioning and set data type --echo ---- Partitioning and set data type
--disable_query_log
# DATA DIRECTORY
eval SET @data_dir = 'DATA DIRECTORY =
''/tmp''';
let $data_directory = `select @data_dir`;
#INDEX DIRECTORY
eval SET @indx_dir = 'INDEX DIRECTORY =
''/tmp''';
let $index_directory = `select @indx_dir`;
--enable_query_log
eval create table t1 (a set('A','B','C','D','E','F','G','H','I','J','K','L') not null, primary key(a)) engine=$engine eval create table t1 (a set('A','B','C','D','E','F','G','H','I','J','K','L') not null, primary key(a)) engine=$engine
partition by key (a) ( partition by key (a) (
partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, partition pa1 max_rows=20 min_rows=2,
partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, partition pa2 max_rows=30 min_rows=3,
partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, partition pa3 max_rows=30 min_rows=4,
partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
show create table t1; show create table t1;
insert into t1 values ('A,B'),('C,D'),('E,L'),('G,H,K'); insert into t1 values ('A,B'),('C,D'),('E,L'),('G,H,K');
select * from t1 order by a; select * from t1 order by a;
......
--disable_query_log
# DATA DIRECTORY
eval SET @data_dir = 'DATA DIRECTORY =
''/tmp''';
let $data_directory = `select @data_dir`;
#INDEX DIRECTORY
eval SET @indx_dir = 'INDEX DIRECTORY =
''/tmp''';
let $index_directory = `select @indx_dir`;
--enable_query_log
eval create table t1 (a smallint unsigned not null, primary key(a)) engine=$engine eval create table t1 (a smallint unsigned not null, primary key(a)) engine=$engine
partition by key (a) ( partition by key (a) (
partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, partition pa1 max_rows=20 min_rows=2,
partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, partition pa2 max_rows=30 min_rows=3,
partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, partition pa3 max_rows=30 min_rows=4,
partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
show create table t1; show create table t1;
insert into t1 values (65535), (65534), (65533), (65532), (1), (2), (256); insert into t1 values (65535), (65534), (65533), (65532), (1), (2), (256);
select * from t1; select * from t1;
......
--echo ---- Partitioning and text data type --echo ---- Partitioning and text data type
--disable_query_log
# DATA DIRECTORY
eval SET @data_dir = 'DATA DIRECTORY =
''/tmp''';
let $data_directory = `select @data_dir`;
#INDEX DIRECTORY
eval SET @indx_dir = 'INDEX DIRECTORY =
''/tmp''';
let $index_directory = `select @indx_dir`;
--enable_query_log
--error ER_BLOB_FIELD_IN_PART_FUNC_ERROR --error ER_BLOB_FIELD_IN_PART_FUNC_ERROR
eval create table t1 (a text not null, primary key(a(767))) engine=$engine eval create table t1 (a text not null, primary key(a(767))) engine=$engine
partition by key (a) ( partition by key (a) (
partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, partition pa1 max_rows=20 min_rows=2,
partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, partition pa2 max_rows=30 min_rows=3,
partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, partition pa3 max_rows=30 min_rows=4,
partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
#show create table t1; #show create table t1;
#insert into t1 values (repeat('a',1000)), ('b'), (repeat('a',500)), (repeat('b',64)); #insert into t1 values (repeat('a',1000)), ('b'), (repeat('a',500)), (repeat('b',64));
......
--disable_query_log
# DATA DIRECTORY
eval SET @data_dir = 'DATA DIRECTORY =
''/tmp''';
let $data_directory = `select @data_dir`;
#INDEX DIRECTORY
eval SET @indx_dir = 'INDEX DIRECTORY =
''/tmp''';
let $index_directory = `select @indx_dir`;
--enable_query_log
eval create table t1 (a time not null, primary key(a)) engine=$engine eval create table t1 (a time not null, primary key(a)) engine=$engine
partition by key (a) ( partition by key (a) (
partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, partition pa1 max_rows=20 min_rows=2,
partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, partition pa2 max_rows=30 min_rows=3,
partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, partition pa3 max_rows=30 min_rows=4,
partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
show create table t1; show create table t1;
insert into t1 values ('21:21:21'), ('12:10:30'), ('03:03:03'), ('23:59'); insert into t1 values ('21:21:21'), ('12:10:30'), ('03:03:03'), ('23:59');
select * from t1; select * from t1;
......
--disable_query_log
# DATA DIRECTORY
eval SET @data_dir = 'DATA DIRECTORY =
''/tmp''';
let $data_directory = `select @data_dir`;
#INDEX DIRECTORY
eval SET @indx_dir = 'INDEX DIRECTORY =
''/tmp''';
let $index_directory = `select @indx_dir`;
--enable_query_log
eval create table t1 (a timestamp not null, primary key(a)) engine=$engine eval create table t1 (a timestamp not null, primary key(a)) engine=$engine
partition by key (a) ( partition by key (a) (
partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, partition pa1 max_rows=20 min_rows=2,
partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, partition pa2 max_rows=30 min_rows=3,
partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, partition pa3 max_rows=30 min_rows=4,
partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
show create table t1; show create table t1;
insert into t1 values ('1975-01-01 21:21:21'), ('2020-12-31 12:10:30'), ('1980-10-14 03:03'), ('2000-06-15 23:59'); insert into t1 values ('1975-01-01 21:21:21'), ('2020-12-31 12:10:30'), ('1980-10-14 03:03'), ('2000-06-15 23:59');
select * from t1; select * from t1;
......
--disable_query_log
# DATA DIRECTORY
eval SET @data_dir = 'DATA DIRECTORY =
''/tmp''';
let $data_directory = `select @data_dir`;
#INDEX DIRECTORY
eval SET @indx_dir = 'INDEX DIRECTORY =
''/tmp''';
let $index_directory = `select @indx_dir`;
--enable_query_log
eval create table t1 (a tinyint unsigned not null, primary key(a)) engine=$engine eval create table t1 (a tinyint unsigned not null, primary key(a)) engine=$engine
partition by key (a) ( partition by key (a) (
partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, partition pa1 max_rows=20 min_rows=2,
partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, partition pa2 max_rows=30 min_rows=3,
partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, partition pa3 max_rows=30 min_rows=4,
partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
show create table t1; show create table t1;
insert into t1 values (255), (254), (253), (252), (1), (2), (128); insert into t1 values (255), (254), (253), (252), (1), (2), (128);
select * from t1; select * from t1;
......
--echo ---- Partitioning and varbinary data type --echo ---- Partitioning and varbinary data type
--disable_query_log
# DATA DIRECTORY
eval SET @data_dir = 'DATA DIRECTORY =
''/tmp''';
let $data_directory = `select @data_dir`;
#INDEX DIRECTORY
eval SET @indx_dir = 'INDEX DIRECTORY =
''/tmp''';
let $index_directory = `select @indx_dir`;
--enable_query_log
eval create table t1 (a varbinary(767) not null, primary key(a)) engine=$engine eval create table t1 (a varbinary(767) not null, primary key(a)) engine=$engine
partition by key (a) ( partition by key (a) (
partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, partition pa1 max_rows=20 min_rows=2,
partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, partition pa2 max_rows=30 min_rows=3,
partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, partition pa3 max_rows=30 min_rows=4,
partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); partition pa4 max_rows=40 min_rows=2);
show create table t1; show create table t1;
insert into t1 values (repeat('a',767)), ('b'), (repeat('a',500)), (repeat('b',64)); insert into t1 values (repeat('a',767)), ('b'), (repeat('a',500)), (repeat('b',64));
select * from t1; select * from t1;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment