summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Ronstrom <mikael@mysql.com>2009-08-03 12:14:48 +0200
committerMikael Ronstrom <mikael@mysql.com>2009-08-03 12:14:48 +0200
commit72ab53043621d2f67076fa83442e4ec60239ab81 (patch)
tree143073357ed9abef8ace7fd136283baecfa9f183
parent1e0b8f74e1f428cc7a9943f2328fc33b23ed777a (diff)
parent40b85f65a7aa90c3a51a0ae64bb2af31e83a33eb (diff)
downloadmariadb-git-72ab53043621d2f67076fa83442e4ec60239ab81.tar.gz
Auto-merge
-rwxr-xr-xCMakeLists.txt10
-rw-r--r--client/Makefile.am2
-rw-r--r--client/mysql.cc31
-rw-r--r--client/mysqldump.c6
-rw-r--r--include/config-netware.h2
-rw-r--r--include/config-win.h4
-rw-r--r--include/myisammrg.h1
-rw-r--r--libmysql/Makefile.shared2
-rw-r--r--libmysqld/Makefile.am2
-rw-r--r--libmysqld/emb_qcache.h2
-rw-r--r--libmysqld/lib_sql.cc34
-rw-r--r--mysql-test/r/merge.result46
-rw-r--r--mysql-test/r/mysql.result24
-rw-r--r--mysql-test/r/mysqldump.result59
-rw-r--r--mysql-test/r/outfile_loaddata.result139
-rw-r--r--mysql-test/r/partition.result13
-rw-r--r--mysql-test/r/partition_csv.result43
-rw-r--r--mysql-test/r/sp_notembedded.result22
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result20
-rw-r--r--mysql-test/suite/binlog/t/binlog_stm_unsafe_warning-master.opt2
-rw-r--r--mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test35
-rw-r--r--mysql-test/t/innodb_notembedded.test10
-rw-r--r--mysql-test/t/merge.test43
-rw-r--r--mysql-test/t/mysql.test14
-rw-r--r--mysql-test/t/mysqldump.test85
-rw-r--r--mysql-test/t/outfile_loaddata.test143
-rw-r--r--mysql-test/t/partition.test21
-rw-r--r--mysql-test/t/partition_csv.test61
-rw-r--r--mysql-test/t/sp_notembedded.test36
-rw-r--r--mysys/Makefile.am2
-rw-r--r--sql/Makefile.am2
-rw-r--r--sql/field.cc39
-rw-r--r--sql/ha_ndbcluster_binlog.cc1
-rw-r--r--sql/ha_partition.cc7
-rw-r--r--sql/mysqld.cc6
-rw-r--r--sql/protocol.cc130
-rw-r--r--sql/protocol.h2
-rw-r--r--sql/share/errmsg.txt3
-rw-r--r--sql/sp_head.cc4
-rw-r--r--sql/sql_class.cc63
-rw-r--r--sql/sql_class.h1
-rw-r--r--sql/sql_load.cc11
-rw-r--r--sql/sql_partition.cc7
-rw-r--r--sql/sql_string.cc73
-rw-r--r--sql/sql_string.h16
-rw-r--r--sql/sql_yacc.yy2
-rw-r--r--sql/unireg.h4
-rw-r--r--storage/myisammrg/ha_myisammrg.cc6
-rw-r--r--storage/myisammrg/ha_myisammrg.h3
-rw-r--r--storage/myisammrg/myrg_info.c18
-rw-r--r--storage/ndb/src/mgmsrv/Makefile.am2
51 files changed, 1156 insertions, 158 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8aacfe8e382..0b8acba33a7 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,6 +14,9 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
+IF(COMMAND cmake_policy)
+ cmake_policy(SET CMP0005 NEW)
+ENDIF(COMMAND cmake_policy)
PROJECT(MySql)
@@ -28,6 +31,13 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in
# Set standard options
ADD_DEFINITIONS(-DHAVE_YASSL)
+ADD_DEFINITIONS(-DCMAKE_CONFIGD)
+ADD_DEFINITIONS(-DDEFAULT_MYSQL_HOME="c:/Program Files/MySQL/MySQL Server ${MYSQL_BASE_VERSION}/")
+ADD_DEFINITIONS(-DDEFAULT_BASEDIR="c:/Program Files/MySQL/")
+ADD_DEFINITIONS(-DMYSQL_DATADIR="c:/Program Files/MySQL/MySQL Server ${MYSQL_BASE_VERSION}/data")
+ADD_DEFINITIONS(-DDEFAULT_CHARSET_HOME="c:/Program Files/MySQL/MySQL Server ${MYSQL_BASE_VERSION}/")
+ADD_DEFINITIONS(-DPACKAGE=mysql)
+ADD_DEFINITIONS(-DSHAREDIR="share")
# Set debug options
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DFORCE_INIT_OF_VARS")
diff --git a/client/Makefile.am b/client/Makefile.am
index ecdd010575f..ccd0d8aada0 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -101,7 +101,7 @@ mysql_upgrade_SOURCES= mysql_upgrade.c \
# Fix for mit-threads
DEFS = -DMYSQL_CLIENT_NO_THREADS \
-DDEFAULT_MYSQL_HOME="\"$(prefix)\"" \
- -DDATADIR="\"$(localstatedir)\""
+ -DMYSQL_DATADIR="\"$(localstatedir)\""
sql_src=log_event.h mysql_priv.h rpl_constants.h \
rpl_utility.h rpl_tblmap.h rpl_tblmap.cc \
diff --git a/client/mysql.cc b/client/mysql.cc
index 05f15e3267a..dc7022a0ffa 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -170,6 +170,8 @@ static const char *xmlmeta[] = {
"<", "&lt;",
">", "&gt;",
"\"", "&quot;",
+ /* Turn \0 into a space. Why not &#0;? That's not valid XML or HTML. */
+ "\0", " ",
0, 0
};
static const char *day_names[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
@@ -3502,11 +3504,29 @@ print_table_data_vertically(MYSQL_RES *result)
mysql_field_seek(result,0);
tee_fprintf(PAGER,
"*************************** %d. row ***************************\n", row_count);
+
+ ulong *lengths= mysql_fetch_lengths(result);
+
for (uint off=0; off < mysql_num_fields(result); off++)
{
field= mysql_fetch_field(result);
tee_fprintf(PAGER, "%*s: ",(int) max_length,field->name);
- tee_fprintf(PAGER, "%s\n",cur[off] ? (char*) cur[off] : "NULL");
+ if (cur[off])
+ {
+ unsigned int i;
+ const char *p;
+
+ for (i= 0, p= cur[off]; i < lengths[off]; i+= 1, p+= 1)
+ {
+ if (*p == '\0')
+ tee_putc((int)' ', PAGER);
+ else
+ tee_putc((int)*p, PAGER);
+ }
+ tee_putc('\n', PAGER);
+ }
+ else
+ tee_fprintf(PAGER, "NULL\n");
}
}
}
@@ -3573,7 +3593,7 @@ xmlencode_print(const char *src, uint length)
tee_fputs("NULL", PAGER);
else
{
- for (const char *p = src; *p && length; *p++, length--)
+ for (const char *p = src; length; *p++, length--)
{
const char *t;
if ((t = array_value(xmlmeta, *p)))
@@ -3593,7 +3613,12 @@ safe_put_field(const char *pos,ulong length)
else
{
if (opt_raw_data)
- tee_fputs(pos, PAGER);
+ {
+ unsigned long i;
+ /* Can't use tee_fputs(), it stops with NUL characters. */
+ for (i= 0; i < length; i++, pos++)
+ tee_putc(*pos, PAGER);
+ }
else for (const char *end=pos+length ; pos != end ; pos++)
{
#ifdef USE_MB
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 193652b88ff..a4f7cabb385 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -3137,6 +3137,12 @@ static void dump_table(char *table, char *db)
dynstr_append_checked(&query_string, filename);
dynstr_append_checked(&query_string, "'");
+ dynstr_append_checked(&query_string, " /*!50137 CHARACTER SET ");
+ dynstr_append_checked(&query_string, default_charset == mysql_universal_client_charset ?
+ my_charset_bin.name : /* backward compatibility */
+ default_charset);
+ dynstr_append_checked(&query_string, " */");
+
if (fields_terminated || enclosed || opt_enclosed || escaped)
dynstr_append_checked(&query_string, " FIELDS");
diff --git a/include/config-netware.h b/include/config-netware.h
index e6bddee034e..4b9e1437170 100644
--- a/include/config-netware.h
+++ b/include/config-netware.h
@@ -131,7 +131,7 @@ extern "C" {
#define DEFAULT_BASEDIR "sys:/"
#define SHAREDIR "share/"
#define DEFAULT_CHARSET_HOME "sys:/mysql/"
-#define DATADIR "data/"
+#define MYSQL_DATADIR "data/"
/* 64-bit file system calls */
#define SIZEOF_OFF_T 8
diff --git a/include/config-win.h b/include/config-win.h
index ce8c0fd17ee..af4915440b1 100644
--- a/include/config-win.h
+++ b/include/config-win.h
@@ -313,13 +313,15 @@ inline ulonglong double2ulonglong(double d)
#ifdef _CUSTOMCONFIG_
#include <custom_conf.h>
#else
+#ifndef CMAKE_CONFIGD
#define DEFAULT_MYSQL_HOME "c:\\mysql"
-#define DATADIR "c:\\mysql\\data"
+#define MYSQL_DATADIR "c:\\mysql\\data"
#define PACKAGE "mysql"
#define DEFAULT_BASEDIR "C:\\"
#define SHAREDIR "share"
#define DEFAULT_CHARSET_HOME "C:/mysql/"
#endif
+#endif
#ifndef DEFAULT_HOME_ENV
#define DEFAULT_HOME_ENV MYSQL_HOME
#endif
diff --git a/include/myisammrg.h b/include/myisammrg.h
index 446ecb7d719..31ce3fa47b8 100644
--- a/include/myisammrg.h
+++ b/include/myisammrg.h
@@ -47,6 +47,7 @@ typedef struct st_mymerge_info /* Struct from h_info */
ulonglong deleted; /* Deleted records in database */
ulonglong recpos; /* Pos for last used record */
ulonglong data_file_length;
+ ulonglong dupp_key_pos; /* Offset of the Duplicate key in the merge table */
uint reclength; /* Recordlength */
int errkey; /* With key was dupplicated on err */
uint options; /* HA_OPTION_... used */
diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared
index 43e86ea31e8..3e93b7daf84 100644
--- a/libmysql/Makefile.shared
+++ b/libmysql/Makefile.shared
@@ -85,7 +85,7 @@ BUILT_SOURCES = link_sources
CLEANFILES = $(target_libadd) $(SHLIBOBJS) \
$(target) $(BUILT_SOURCES)
DEFS = -DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \
- -DDATADIR="\"$(MYSQLDATAdir)\"" \
+ -DMYSQL_DATADIR="\"$(MYSQLDATAdir)\"" \
-DDEFAULT_HOME_ENV=MYSQL_HOME \
-DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX \
-DDEFAULT_SYSCONFDIR="\"$(sysconfdir)\"" \
diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am
index ef2fab2da6d..a9bd8d9e17c 100644
--- a/libmysqld/Makefile.am
+++ b/libmysqld/Makefile.am
@@ -26,7 +26,7 @@ pkgplugindir = $(pkglibdir)/plugin
EXTRA_DIST = libmysqld.def CMakeLists.txt
DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \
-DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
- -DDATADIR="\"$(MYSQLDATAdir)\"" \
+ -DMYSQL_DATADIR="\"$(MYSQLDATAdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
-DPLUGINDIR="\"$(pkgplugindir)\""
INCLUDES= -I$(top_builddir)/include -I$(top_srcdir)/include \
diff --git a/libmysqld/emb_qcache.h b/libmysqld/emb_qcache.h
index 67413739f2c..ecf91487667 100644
--- a/libmysqld/emb_qcache.h
+++ b/libmysqld/emb_qcache.h
@@ -79,4 +79,4 @@ public:
uint emb_count_querycache_size(THD *thd);
int emb_load_querycache_result(THD *thd, Querycache_stream *src);
void emb_store_querycache_result(Querycache_stream *dst, THD* thd);
-void net_send_eof(THD *thd, uint server_status, uint total_warn_count);
+bool net_send_eof(THD *thd, uint server_status, uint total_warn_count);
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index ec108bf372e..d4a200c07b2 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -803,11 +803,11 @@ MYSQL_DATA *THD::alloc_new_dataset()
*/
static
-void
+bool
write_eof_packet(THD *thd, uint server_status, uint total_warn_count)
{
if (!thd->mysql) // bootstrap file handling
- return;
+ return FALSE;
/*
The following test should never be true, but it's better to do it
because if 'is_fatal_error' is set the server is not going to execute
@@ -822,6 +822,7 @@ write_eof_packet(THD *thd, uint server_status, uint total_warn_count)
*/
thd->cur_data->embedded_info->warning_count=
(thd->spcont ? 0 : min(total_warn_count, 65535));
+ return FALSE;
}
@@ -1032,31 +1033,34 @@ bool Protocol_binary::write()
@sa Server implementation of net_send_ok in protocol.cc for
description of the arguments.
- @return The function does not return errors.
+ @return
+ @retval TRUE An error occurred
+ @retval FALSE Success
*/
-void
+bool
net_send_ok(THD *thd,
uint server_status, uint total_warn_count,
ha_rows affected_rows, ulonglong id, const char *message)
{
DBUG_ENTER("emb_net_send_ok");
MYSQL_DATA *data;
+ bool error;
MYSQL *mysql= thd->mysql;
if (!mysql) // bootstrap file handling
- DBUG_VOID_RETURN;
+ DBUG_RETURN(FALSE);
if (!(data= thd->alloc_new_dataset()))
- return;
+ return TRUE;
data->embedded_info->affected_rows= affected_rows;
data->embedded_info->insert_id= id;
if (message)
strmake(data->embedded_info->info, message,
sizeof(data->embedded_info->info)-1);
- write_eof_packet(thd, server_status, total_warn_count);
+ error= write_eof_packet(thd, server_status, total_warn_count);
thd->cur_data= 0;
- DBUG_VOID_RETURN;
+ DBUG_RETURN(error);
}
@@ -1065,18 +1069,21 @@ net_send_ok(THD *thd,
@sa net_send_ok
- @return This function does not return errors.
+ @return
+ @retval TRUE An error occurred
+ @retval FALSE Success
*/
-void
+bool
net_send_eof(THD *thd, uint server_status, uint total_warn_count)
{
- write_eof_packet(thd, server_status, total_warn_count);
+ bool error= write_eof_packet(thd, server_status, total_warn_count);
thd->cur_data= 0;
+ return error;
}
-void net_send_error_packet(THD *thd, uint sql_errno, const char *err)
+bool net_send_error_packet(THD *thd, uint sql_errno, const char *err)
{
MYSQL_DATA *data= thd->cur_data;
struct embedded_query_result *ei;
@@ -1084,7 +1091,7 @@ void net_send_error_packet(THD *thd, uint sql_errno, const char *err)
if (!thd->mysql) // bootstrap file handling
{
fprintf(stderr, "ERROR: %d %s\n", sql_errno, err);
- return;
+ return TRUE;
}
if (!data)
@@ -1096,6 +1103,7 @@ void net_send_error_packet(THD *thd, uint sql_errno, const char *err)
strmov(ei->sqlstate, mysql_errno_to_sqlstate(sql_errno));
ei->server_status= thd->server_status;
thd->cur_data= 0;
+ return FALSE;
}
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index 934085ab796..d3563e9f1c1 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -2115,6 +2115,52 @@ insert into m1 (col1) values (1);
insert into m1 (col1) values (1);
ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
drop table m1, t1;
+#
+# Bug#45800 crash when replacing into a merge table and there is a duplicate
+#
+# Replace duplicate value in child table when merge table doesn't have key
+CREATE TABLE t1 (c1 INT PRIMARY KEY) ENGINE=MyISAM;
+CREATE TABLE m1 (c1 INT NOT NULL) ENGINE=MRG_MyISAM INSERT_METHOD=LAST UNION=(t1);
+INSERT INTO m1 VALUES (666);
+SELECT * FROM m1;
+c1
+666
+# insert the duplicate value into the merge table
+REPLACE INTO m1 VALUES (666);
+SELECT * FROM m1;
+c1
+666
+DROP TABLE m1, t1;
+# Insert... on duplicate key update (with duplicate values in the table)
+CREATE TABLE t1 (c1 INT PRIMARY KEY) ENGINE=MyISAM;
+CREATE TABLE m1 (c1 INT NOT NULL) ENGINE=MRG_MyISAM INSERT_METHOD=LAST UNION=(t1);
+INSERT INTO m1 VALUES (666);
+SELECT * FROM m1;
+c1
+666
+# insert the duplicate value into the merge table
+INSERT INTO m1 VALUES (666) ON DUPLICATE KEY UPDATE c1=c1+1;
+SELECT * FROM m1;
+c1
+667
+DROP TABLE m1, t1;
+# Insert duplicate value on MERGE table, where, MERGE has a key but MyISAM has more keys
+CREATE TABLE t1 (c1 INT, c2 INT, UNIQUE (c1), UNIQUE (c2));
+CREATE TABLE m1 (c1 INT, c2 INT, UNIQUE (c1)) ENGINE=MRG_MyISAM INSERT_METHOD=LAST UNION=(t1);
+INSERT INTO m1 VALUES (1,2);
+# insert the duplicate value into the merge table
+INSERT INTO m1 VALUES (3,2);
+ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
+DROP TABLE m1,t1;
+# Try to define MERGE and MyISAM with keys on different columns
+CREATE TABLE t1 (c1 INT, c2 INT, UNIQUE (c1));
+CREATE TABLE m1 (c1 INT, c2 INT, UNIQUE (c2)) ENGINE=MRG_MyISAM INSERT_METHOD=LAST UNION=(t1);
+# Try accessing the merge table for inserts (error occurs)
+INSERT INTO m1 VALUES (1,2);
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+INSERT INTO m1 VALUES (1,4);
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+DROP TABLE m1,t1;
CREATE TABLE t1 (
col1 INT(10)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result
index b77d30a4973..c02073df677 100644
--- a/mysql-test/r/mysql.result
+++ b/mysql-test/r/mysql.result
@@ -207,5 +207,27 @@ Warning (Code 1286): Unknown table engine 'nonexistent2'
Warning (Code 1266): Using storage engine MyISAM for table 't2'
Error (Code 1050): Table 't2' already exists
drop tables t1, t2;
-<TABLE BORDER=1><TR><TH>&lt;</TH></TR><TR><TD>&lt; &amp; &gt;</TD></TR></TABLE>
+<TABLE BORDER=1><TR><TH>&lt;</TH></TR><TR><TD>&lt; &amp; &gt;</TD></TR></TABLE>create table t1 (a char(5));
+insert into t1 values ('\0b\0');
+a
+\0b\0
+a
+\0b\0
++------+
+| a |
++------+
+| b |
++------+
+*************************** 1. row ***************************
+a: b
+<TABLE BORDER=1><TR><TH>a</TH></TR><TR><TD> b </TD></TR></TABLE><?xml version="1.0"?>
+
+<resultset statement="select a from t1
+" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <row>
+ <field name="a"> b </field>
+ </row>
+</resultset>
+drop table t1;
+
End of tests
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 345a53abfda..8162e1aca05 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -4502,5 +4502,64 @@ DROP PROCEDURE IF EXISTS pr1;
DROP TRIGGER IF EXISTS tr1;
DROP TABLE IF EXISTS t1;
#
+# Bug #30946: mysqldump silently ignores --default-character-set
+# when used with --tab
+#
+# Also see outfile_loaddata.test
+#
+SET NAMES utf8;
+CREATE TABLE t1 (a INT, b CHAR(10) CHARSET koi8r, c CHAR(10) CHARSET latin1);
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t1 VALUES (1, 'ABC-АБВ', 'DEF-ÂÃÄ'), (2, NULL, NULL);
+# error on multi-character ENCLOSED/ESCAPED BY
+# default '--default-charset' (binary):
+##################################################
+1 ABC- DEF-
+2 \N \N
+##################################################
+TRUNCATE t2;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary;
+SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
+a b c
+1 ABC-АБВ DEF-ÂÃÄ
+2 NULL NULL
+# utf8:
+##################################################
+1 ABC-АБВ DEF-ÂÃÄ
+2 \N \N
+##################################################
+TRUNCATE t2;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET utf8;
+SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
+a b c
+1 ABC-АБВ DEF-ÂÃÄ
+2 NULL NULL
+# latin1 (data corruption is expected):
+##################################################
+1 ABC-??? DEF-
+2 \N \N
+##################################################
+TRUNCATE t2;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET latin1 ;
+SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
+a b c
+1 ABC-??? DEF-ÂÃÄ
+1 ABC-АБВ DEF-ÂÃÄ
+2 NULL NULL
+# koi8r (data corruption is expected):
+##################################################
+1 ABC- DEF-???
+2 \N \N
+##################################################
+TRUNCATE t2;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET koi8r;
+SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
+a b c
+1 ABC-АБВ DEF-???
+1 ABC-АБВ DEF-ÂÃÄ
+2 NULL NULL
+SET NAMES default;
+DROP TABLE t1, t2;
+#
# End of 5.1 tests
#
diff --git a/mysql-test/r/outfile_loaddata.result b/mysql-test/r/outfile_loaddata.result
index 4a9bdcf412d..453e3adb54c 100644
--- a/mysql-test/r/outfile_loaddata.result
+++ b/mysql-test/r/outfile_loaddata.result
@@ -91,13 +91,152 @@ SELECT HEX(c1) FROM t1;
HEX(c1)
C3
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug32533.txt' FIELDS ENCLOSED BY 0xC3 FROM t1;
+Warnings:
+Warning 1638 Non-ASCII separator arguments are not fully supported
TRUNCATE t1;
SELECT HEX(LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug32533.txt'));
HEX(LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug32533.txt'))
C35CC3C30A
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug32533.txt' INTO TABLE t1 FIELDS ENCLOSED BY 0xC3;
+Warnings:
+Warning 1638 Non-ASCII separator arguments are not fully supported
SELECT HEX(c1) FROM t1;
HEX(c1)
C3
DROP TABLE t1;
# End of 5.0 tests.
+#
+# Bug #30946: mysqldump silently ignores --default-character-set
+# when used with --tab
+#
+# Also see mysqldump.test
+#
+SET NAMES utf8;
+CREATE TABLE t1 (a INT, b CHAR(10) CHARSET koi8r, c CHAR(10) CHARSET latin1);
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t1 VALUES (1, 'ABC-АБВ', 'DEF-ÂÃÄ'), (2, NULL, NULL);
+# Error on multi-character ENCLOSED/ESCAPED BY
+SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' FIELDS ENCLOSED BY '12345';
+ERROR 42000: Field separator argument is not what is expected; check the manual
+SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' FIELDS ESCAPED BY '12345';
+ERROR 42000: Field separator argument is not what is expected; check the manual
+# "Not implemented" warning on multibyte ENCLOSED/ESCAPED BY character,
+# LOAD DATA rises error or has unpredictable result -- to be fixed later
+SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' FIELDS ENCLOSED BY 'ъ';
+Warnings:
+Warning 1638 Non-ASCII separator arguments are not fully supported
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary FIELDS ENCLOSED BY 'ъ';
+ERROR 42000: Field separator argument is not what is expected; check the manual
+SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' FIELDS ESCAPED BY 'ъ';
+Warnings:
+Warning 1638 Non-ASCII separator arguments are not fully supported
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary FIELDS ESCAPED BY 'ъ';
+ERROR 42000: Field separator argument is not what is expected; check the manual
+SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' FIELDS TERMINATED BY 'ъ';
+Warnings:
+Warning 1638 Non-ASCII separator arguments are not fully supported
+##################################################
+1ъABC-ъDEF-
+2ъ\Nъ\N
+##################################################
+TRUNCATE t2;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary FIELDS TERMINATED BY 'ъ';
+Warnings:
+Warning 1638 Non-ASCII separator arguments are not fully supported
+Warning 1265 Data truncated for column 'a' at row 1
+Warning 1261 Row 1 doesn't contain data for all columns
+Warning 1261 Row 1 doesn't contain data for all columns
+Warning 1265 Data truncated for column 'a' at row 2
+Warning 1261 Row 2 doesn't contain data for all columns
+Warning 1261 Row 2 doesn't contain data for all columns
+SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
+a b c
+1 NULL NULL
+1 ABC-АБВ DEF-ÂÃÄ
+2 NULL NULL
+SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' LINES STARTING BY 'ъ';
+Warnings:
+Warning 1638 Non-ASCII separator arguments are not fully supported
+##################################################
+ъ1 ABC- DEF-
+ъ2 \N \N
+##################################################
+TRUNCATE t2;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary LINES STARTING BY 'ъ';
+Warnings:
+Warning 1638 Non-ASCII separator arguments are not fully supported
+SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
+a b c
+1 ABC-АБВ DEF-ÂÃÄ
+2 NULL NULL
+SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' LINES TERMINATED BY 'ъ';
+Warnings:
+Warning 1638 Non-ASCII separator arguments are not fully supported
+##################################################
+1 ABC- DEF-ъ2 \N \Nъ##################################################
+TRUNCATE t2;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary LINES TERMINATED BY 'ъ';
+Warnings:
+Warning 1638 Non-ASCII separator arguments are not fully supported
+SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
+a b c
+1 ABC-АБВ DEF-ÂÃÄ
+1 ABC-АБВ DEF-ÂÃÄÑŠ2
+2 NULL NULL
+# Default (binary) charset:
+SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' FROM t1;
+##################################################
+1 ABC- DEF-
+2 \N \N
+##################################################
+TRUNCATE t2;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary;
+SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
+a b c
+1 ABC-АБВ DEF-ÂÃÄ
+2 NULL NULL
+# latin1 charset (INTO OUTFILE warning is expected):
+SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' CHARACTER SET latin1 FROM t1;
+Warnings:
+Warning 1366 Incorrect string value: '\xE1\xE2\xF7' for column 'b' at row 1
+##################################################
+1 ABC-??? DEF-
+2 \N \N
+##################################################
+TRUNCATE t2;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET latin1 ;
+SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
+a b c
+1 ABC-??? DEF-ÂÃÄ
+1 ABC-АБВ DEF-ÂÃÄ
+2 NULL NULL
+# KOI8-R charset (INTO OUTFILE warning is expected):
+SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' CHARACTER SET koi8r FROM t1;
+Warnings:
+Warning 1366 Incorrect string value: '\xC2\xC3\xC4' for column 'c' at row 1
+##################################################
+1 ABC- DEF-???
+2 \N \N
+##################################################
+TRUNCATE t2;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET koi8r;
+SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
+a b c
+1 ABC-АБВ DEF-???
+1 ABC-АБВ DEF-ÂÃÄ
+2 NULL NULL
+# UTF-8 charset:
+SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' CHARACTER SET utf8 FROM t1;
+##################################################
+1 ABC-АБВ DEF-ÂÃÄ
+2 \N \N
+##################################################
+TRUNCATE t2;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET utf8;
+SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
+a b c
+1 ABC-АБВ DEF-ÂÃÄ
+2 NULL NULL
+SET NAMES default;
+DROP TABLE t1, t2;
+# End of 5.1 tests.
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index 9643478b96b..8b95f4e7e12 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -1,4 +1,3 @@
-SET @old_general_log= @@global.general_log;
drop table if exists t1, t2;
CREATE TABLE t1 (a INT, FOREIGN KEY (a) REFERENCES t0 (a))
ENGINE=MyISAM
@@ -1627,17 +1626,6 @@ create table t (s1 int) engine=myisam partition by key (s1);
create trigger t_ad after delete on t for each row insert into t values (old.s1);
insert into t values (1);
drop table t;
-USE mysql;
-TRUNCATE TABLE general_log;
-SET @old_general_log_state = @@global.general_log;
-SET GLOBAL general_log = 0;
-ALTER TABLE general_log ENGINE = MyISAM;
-ALTER TABLE general_log PARTITION BY RANGE (TO_DAYS(event_time))
-(PARTITION p0 VALUES LESS THAN (733144), PARTITION p1 VALUES LESS THAN (3000000));
-ERROR HY000: Incorrect usage of PARTITION and log table
-ALTER TABLE general_log ENGINE = CSV;
-SET GLOBAL general_log = @old_general_log_state;
-use test;
create table t2 (b int);
create table t1 (b int)
PARTITION BY RANGE (t2.b) (
@@ -1998,4 +1986,3 @@ PARTITION BY HASH(id) PARTITIONS 2;
DROP TABLE t1;
SET SESSION SQL_MODE=DEFAULT;
End of 5.1 tests
-SET @@global.general_log= @old_general_log;
diff --git a/mysql-test/r/partition_csv.result b/mysql-test/r/partition_csv.result
index b5e1dcd9541..07651f29da4 100644
--- a/mysql-test/r/partition_csv.result
+++ b/mysql-test/r/partition_csv.result
@@ -5,11 +5,50 @@ partition by list (a)
(partition p0 values in (null));
ERROR HY000: Engine cannot be used in partitioned tables
USE mysql;
+TRUNCATE TABLE general_log;
+SET @old_general_log_state = @@global.general_log;
SET GLOBAL general_log = 0;
ALTER TABLE general_log ENGINE = MyISAM;
ALTER TABLE general_log PARTITION BY RANGE (TO_DAYS(event_time))
-(PARTITION p0 VALUES LESS THAN (733144),
-PARTITION p1 VALUES LESS THAN (3000000));
+(PARTITION p0 VALUES LESS THAN (733144), PARTITION p1 VALUES LESS THAN (3000000));
ERROR HY000: Incorrect usage of PARTITION and log table
ALTER TABLE general_log ENGINE = CSV;
+SET GLOBAL general_log = @old_general_log_state;
+use test;
+#
+# Bug#40281: partitioning the general log table crashes the server
+#
+# set up partitioned log, and switch to it
+USE mysql;
+SET @old_general_log_state = @@global.general_log;
+SET GLOBAL general_log = 0;
+CREATE TABLE gl_partitioned LIKE general_log;
+ALTER TABLE gl_partitioned ENGINE=myisam;
+ALTER TABLE gl_partitioned PARTITION BY HASH (thread_id) PARTITIONS 10;
+ALTER TABLE general_log RENAME TO gl_nonpartitioned;
+ALTER TABLE gl_partitioned RENAME TO general_log;
+SELECT @@global.log_output INTO @old_glo;
+SET GLOBAL log_output='table';
+SET GLOBAL general_log =1;
+# do some things to be logged to partitioned log, should fail
+USE /* 1 */ test;
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1;
+i
+1
+USE mysql;
+SET GLOBAL general_log =0;
+ALTER TABLE general_log RENAME TO gl_partitioned;
+ALTER TABLE gl_nonpartitioned RENAME TO general_log;
+# show whether we actually logged anything (no) to general_log
+SELECT COUNT(argument) FROM gl_partitioned;
+COUNT(argument)
+0
+DROP TABLE gl_partitioned;
+SET GLOBAL log_output = @old_glo;
SET GLOBAL general_log = 1;
+USE /* 2 */ test;
+DROP TABLE t1;
+SET GLOBAL general_log = @old_general_log_state;
+End of 5.1 tests
diff --git a/mysql-test/r/sp_notembedded.result b/mysql-test/r/sp_notembedded.result
index c6641e673ee..831616f491b 100644
--- a/mysql-test/r/sp_notembedded.result
+++ b/mysql-test/r/sp_notembedded.result
@@ -249,3 +249,25 @@ DROP PROCEDURE p1;
DELETE FROM mysql.user WHERE User='mysqltest_1';
FLUSH PRIVILEGES;
set @@global.concurrent_insert= @old_concurrent_insert;
+#
+# Bug#44521 Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al.
+#
+SELECT GET_LOCK('Bug44521', 0);
+GET_LOCK('Bug44521', 0)
+1
+** Connection con1
+CREATE PROCEDURE p()
+BEGIN
+SELECT 1;
+SELECT GET_LOCK('Bug44521', 100);
+SELECT 2;
+END$
+CALL p();;
+** Default connection
+SELECT RELEASE_LOCK('Bug44521');
+RELEASE_LOCK('Bug44521')
+1
+DROP PROCEDURE p;
+# ------------------------------------------------------------------
+# -- End of 5.1 tests
+# ------------------------------------------------------------------
diff --git a/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result b/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result
index 439bff0cfe1..edbd878982b 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result
@@ -28,3 +28,23 @@ UPDATE t1 SET b='4' WHERE a=1 LIMIT 1;
UPDATE t1 SET b='5' WHERE a=2 ORDER BY a LIMIT 1;
DROP TABLE t1;
DROP DATABASE b42851;
+USE test;
+#
+# Bug#46265: Can not disable warning about unsafe statements for binary logging
+#
+SET @old_log_warnings = @@log_warnings;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(10));
+SET GLOBAL LOG_WARNINGS = 0;
+INSERT INTO t1 VALUES(UUID(), 'Bug#46265');
+Warnings:
+Note 1592 Statement may not be safe to log in statement format.
+SET GLOBAL LOG_WARNINGS = 1;
+INSERT INTO t1 VALUES(UUID(), 'Bug#46265');
+Warnings:
+Note 1592 Statement may not be safe to log in statement format.
+DROP TABLE t1;
+SET GLOBAL log_warnings = @old_log_warnings;
+# Count the number of times the "Unsafe" message was printed
+# to the error log.
+Occurrences: 1
diff --git a/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning-master.opt b/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning-master.opt
index 24c2027e399..91466bcdea3 100644
--- a/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning-master.opt
+++ b/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning-master.opt
@@ -1 +1 @@
---binlog-ignore-db=b42851
+--binlog-ignore-db=b42851 --log-error
diff --git a/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test b/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test
index 0bf685ea921..a5472952f08 100644
--- a/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test
+++ b/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test
@@ -56,6 +56,8 @@ SET SQL_LOG_BIN= 1;
-- echo ### FILTERED database => assertion: warnings ARE NOT shown
+let $old_db= `SELECT DATABASE()`;
+
CREATE DATABASE b42851;
USE b42851;
@@ -71,3 +73,36 @@ DROP TABLE t1;
# clean up
DROP DATABASE b42851;
+
+eval USE $old_db;
+
+--echo #
+--echo # Bug#46265: Can not disable warning about unsafe statements for binary logging
+--echo #
+
+SET @old_log_warnings = @@log_warnings;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(10));
+SET GLOBAL LOG_WARNINGS = 0;
+INSERT INTO t1 VALUES(UUID(), 'Bug#46265');
+SET GLOBAL LOG_WARNINGS = 1;
+INSERT INTO t1 VALUES(UUID(), 'Bug#46265');
+DROP TABLE t1;
+
+SET GLOBAL log_warnings = @old_log_warnings;
+
+let LOG_ERROR= `SELECT @@GLOBAL.log_error`;
+
+--echo # Count the number of times the "Unsafe" message was printed
+--echo # to the error log.
+
+perl;
+ $log_error= $ENV{'LOG_ERROR'};
+ open(FILE, "$log_error") or die("Unable to open $log_error: $!\n");
+ $count = () = grep(/Bug#46265/g,<FILE>);
+ print "Occurrences: $count\n";
+ close(FILE);
+EOF
diff --git a/mysql-test/t/innodb_notembedded.test b/mysql-test/t/innodb_notembedded.test
index 564b947c75e..c74dc931505 100644
--- a/mysql-test/t/innodb_notembedded.test
+++ b/mysql-test/t/innodb_notembedded.test
@@ -36,9 +36,15 @@ rollback;
connection b;
reap;
rollback;
+
+# Cleanup
+connection a;
+disconnect a;
+--source include/wait_until_disconnected.inc
+connection b;
+disconnect b;
+--source include/wait_until_disconnected.inc
connection default;
drop table t1;
drop function f1;
-disconnect a;
-disconnect b;
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test
index 0d90468fc8d..39c805d2b5b 100644
--- a/mysql-test/t/merge.test
+++ b/mysql-test/t/merge.test
@@ -1515,6 +1515,49 @@ insert into m1 (col1) values (1);
drop table m1, t1;
+--echo #
+--echo # Bug#45800 crash when replacing into a merge table and there is a duplicate
+--echo #
+
+--echo # Replace duplicate value in child table when merge table doesn't have key
+CREATE TABLE t1 (c1 INT PRIMARY KEY) ENGINE=MyISAM;
+CREATE TABLE m1 (c1 INT NOT NULL) ENGINE=MRG_MyISAM INSERT_METHOD=LAST UNION=(t1);
+INSERT INTO m1 VALUES (666);
+SELECT * FROM m1;
+--echo # insert the duplicate value into the merge table
+REPLACE INTO m1 VALUES (666);
+SELECT * FROM m1;
+DROP TABLE m1, t1;
+
+--echo # Insert... on duplicate key update (with duplicate values in the table)
+CREATE TABLE t1 (c1 INT PRIMARY KEY) ENGINE=MyISAM;
+CREATE TABLE m1 (c1 INT NOT NULL) ENGINE=MRG_MyISAM INSERT_METHOD=LAST UNION=(t1);
+INSERT INTO m1 VALUES (666);
+SELECT * FROM m1;
+--echo # insert the duplicate value into the merge table
+INSERT INTO m1 VALUES (666) ON DUPLICATE KEY UPDATE c1=c1+1;
+SELECT * FROM m1;
+DROP TABLE m1, t1;
+
+--echo # Insert duplicate value on MERGE table, where, MERGE has a key but MyISAM has more keys
+CREATE TABLE t1 (c1 INT, c2 INT, UNIQUE (c1), UNIQUE (c2));
+CREATE TABLE m1 (c1 INT, c2 INT, UNIQUE (c1)) ENGINE=MRG_MyISAM INSERT_METHOD=LAST UNION=(t1);
+INSERT INTO m1 VALUES (1,2);
+--echo # insert the duplicate value into the merge table
+--error ER_DUP_ENTRY
+INSERT INTO m1 VALUES (3,2);
+DROP TABLE m1,t1;
+
+--echo # Try to define MERGE and MyISAM with keys on different columns
+CREATE TABLE t1 (c1 INT, c2 INT, UNIQUE (c1));
+CREATE TABLE m1 (c1 INT, c2 INT, UNIQUE (c2)) ENGINE=MRG_MyISAM INSERT_METHOD=LAST UNION=(t1);
+--echo # Try accessing the merge table for inserts (error occurs)
+--error ER_WRONG_MRG_TABLE
+INSERT INTO m1 VALUES (1,2);
+--error ER_WRONG_MRG_TABLE
+INSERT INTO m1 VALUES (1,4);
+DROP TABLE m1,t1;
+
#
#Bug #44040 MySQL allows creating a MERGE table upon VIEWs but crashes
#when using it
diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test
index 2bb9a02e9d7..cffa6392fa3 100644
--- a/mysql-test/t/mysql.test
+++ b/mysql-test/t/mysql.test
@@ -387,5 +387,19 @@ drop tables t1, t2;
#
--exec $MYSQL --html test -e "select '< & >' as '<'"
+#
+# Bug #27884: mysql client + null byte
+#
+create table t1 (a char(5));
+insert into t1 values ('\0b\0');
+--exec $MYSQL test -e "select a from t1"
+--exec $MYSQL -r test -e "select a from t1"
+--exec $MYSQL -s test -e "select a from t1"
+--exec $MYSQL --table test -e "select a from t1"
+--exec $MYSQL --vertical test -e "select a from t1"
+--exec $MYSQL --html test -e "select a from t1"
+--exec $MYSQL --xml test -e "select a from t1"
+drop table t1;
+
--echo
--echo End of tests
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index f941cf21c19..07ab9cecd28 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -1496,8 +1496,11 @@ INSERT INTO t1 VALUES (1), (2);
--exec $MYSQL_DUMP --tab=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test
@@ -2050,6 +2053,88 @@ DROP TABLE IF EXISTS t1;
###########################################################################
--echo #
+--echo # Bug #30946: mysqldump silently ignores --default-character-set
+--echo # when used with --tab
+--echo #
+--echo # Also see outfile_loaddata.test
+--echo #
+
+SET NAMES utf8;
+CREATE TABLE t1 (a INT, b CHAR(10) CHARSET koi8r, c CHAR(10) CHARSET latin1);
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t1 VALUES (1, 'ABC-АБВ', 'DEF-ÂÃÄ'), (2, NULL, NULL);
+
+--let $file=$MYSQLTEST_VARDIR/tmp/t1.txt
+
+
+--echo # error on multi-character ENCLOSED/ESCAPED BY
+
+--error 2
+--exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ --fields-enclosed-by='12345' test t1
+--remove_file $file
+
+--error 2
+--exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ --fields-escaped-by='12345' test t1
+--remove_file $file
+
+--echo # default '--default-charset' (binary):
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --tab=$MYSQLTEST_VARDIR/tmp/ test t1
+--echo ##################################################
+--cat_file $file
+--echo ##################################################
+TRUNCATE t2;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary
+--remove_file $file
+SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
+
+
+--echo # utf8:
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --default-character-set=utf8 --tab=$MYSQLTEST_VARDIR/tmp/ test t1
+--echo ##################################################
+--cat_file $file
+--echo ##################################################
+TRUNCATE t2;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET utf8
+--remove_file $file
+SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
+
+
+--echo # latin1 (data corruption is expected):
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --default-character-set=latin1 --tab=$MYSQLTEST_VARDIR/tmp/ test t1
+--echo ##################################################
+--cat_file $file
+--echo ##################################################
+TRUNCATE t2;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET latin1
+--remove_file $file
+SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
+
+
+--echo # koi8r (data corruption is expected):
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --default-character-set=koi8r --tab=$MYSQLTEST_VARDIR/tmp/ test t1
+--echo ##################################################
+--cat_file $file
+--echo ##################################################
+TRUNCATE t2;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET koi8r
+--remove_file $file
+SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
+
+
+SET NAMES default;
+
+DROP TABLE t1, t2;
+
+###########################################################################
+--echo #
--echo # End of 5.1 tests
--echo #
diff --git a/mysql-test/t/outfile_loaddata.test b/mysql-test/t/outfile_loaddata.test
index 2a120871e7d..3f62acbd214 100644
--- a/mysql-test/t/outfile_loaddata.test
+++ b/mysql-test/t/outfile_loaddata.test
@@ -111,3 +111,146 @@ SELECT HEX(c1) FROM t1;
DROP TABLE t1;
--echo # End of 5.0 tests.
+
+###########################################################################
+
+--echo #
+--echo # Bug #30946: mysqldump silently ignores --default-character-set
+--echo # when used with --tab
+--echo #
+--echo # Also see mysqldump.test
+--echo #
+
+SET NAMES utf8;
+CREATE TABLE t1 (a INT, b CHAR(10) CHARSET koi8r, c CHAR(10) CHARSET latin1);
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t1 VALUES (1, 'ABC-АБВ', 'DEF-ÂÃÄ'), (2, NULL, NULL);
+
+--let $file=$MYSQLTEST_VARDIR/tmp/t1.txt
+
+
+--echo # Error on multi-character ENCLOSED/ESCAPED BY
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--error 1083
+--eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS ENCLOSED BY '12345'
+--remove_file $file
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--error 1083
+--eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS ESCAPED BY '12345'
+--remove_file $file
+
+
+--echo # "Not implemented" warning on multibyte ENCLOSED/ESCAPED BY character,
+--echo # LOAD DATA rises error or has unpredictable result -- to be fixed later
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS ENCLOSED BY 'ъ'
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--error 1083 # backward compatibility
+--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary FIELDS ENCLOSED BY 'ъ'
+--remove_file $file
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS ESCAPED BY 'ъ'
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--error 1083 # backward compatibility
+--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary FIELDS ESCAPED BY 'ъ'
+--remove_file $file
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS TERMINATED BY 'ъ'
+--echo ##################################################
+--cat_file $file
+--echo ##################################################
+TRUNCATE t2;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary FIELDS TERMINATED BY 'ъ'
+--remove_file $file
+SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SELECT * FROM t1 INTO OUTFILE '$file' LINES STARTING BY 'ъ'
+--echo ##################################################
+--cat_file $file
+--echo ##################################################
+TRUNCATE t2;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary LINES STARTING BY 'ъ'
+--remove_file $file
+SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SELECT * FROM t1 INTO OUTFILE '$file' LINES TERMINATED BY 'ъ'
+--echo ##################################################
+--cat_file $file
+--echo ##################################################
+TRUNCATE t2;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary LINES TERMINATED BY 'ъ'
+--remove_file $file
+SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
+
+--echo # Default (binary) charset:
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SELECT * INTO OUTFILE '$file' FROM t1
+--echo ##################################################
+--cat_file $file
+--echo ##################################################
+TRUNCATE t2;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary
+--remove_file $file
+SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
+
+
+--echo # latin1 charset (INTO OUTFILE warning is expected):
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SELECT * INTO OUTFILE '$file' CHARACTER SET latin1 FROM t1
+--echo ##################################################
+--cat_file $file
+--echo ##################################################
+TRUNCATE t2;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET latin1
+--remove_file $file
+SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
+
+
+--echo # KOI8-R charset (INTO OUTFILE warning is expected):
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SELECT * INTO OUTFILE '$file' CHARACTER SET koi8r FROM t1
+--echo ##################################################
+--cat_file $file
+--echo ##################################################
+TRUNCATE t2;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET koi8r
+--remove_file $file
+SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
+
+
+--echo # UTF-8 charset:
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SELECT * INTO OUTFILE '$file' CHARACTER SET utf8 FROM t1
+--echo ##################################################
+--cat_file $file
+--echo ##################################################
+TRUNCATE t2;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET utf8
+--remove_file $file
+SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
+
+
+SET NAMES default;
+
+DROP TABLE t1, t2;
+
+###########################################################################
+--echo # End of 5.1 tests.
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index 18bcf84407b..542a992bb0e 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -10,8 +10,6 @@
#
--source include/have_partition.inc
-SET @old_general_log= @@global.general_log;
-
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
@@ -1652,23 +1650,6 @@ insert into t values (1);
drop table t;
#
-# Bug #27816: Log tables ran with partitions crashes the server when logging
-# is enabled.
-#
-
-USE mysql;
-TRUNCATE TABLE general_log;
-SET @old_general_log_state = @@global.general_log;
-SET GLOBAL general_log = 0;
-ALTER TABLE general_log ENGINE = MyISAM;
---error ER_WRONG_USAGE
-ALTER TABLE general_log PARTITION BY RANGE (TO_DAYS(event_time))
- (PARTITION p0 VALUES LESS THAN (733144), PARTITION p1 VALUES LESS THAN (3000000));
-ALTER TABLE general_log ENGINE = CSV;
-SET GLOBAL general_log = @old_general_log_state;
-use test;
-
-#
# Bug #27084 partitioning by list seems failing when using case
# BUG #18198: Case no longer supported, test case removed
#
@@ -1999,5 +1980,3 @@ DROP TABLE t1;
SET SESSION SQL_MODE=DEFAULT;
--echo End of 5.1 tests
-
-SET @@global.general_log= @old_general_log;
diff --git a/mysql-test/t/partition_csv.test b/mysql-test/t/partition_csv.test
index aa3d9d67c26..dd2ef7c1d1f 100644
--- a/mysql-test/t/partition_csv.test
+++ b/mysql-test/t/partition_csv.test
@@ -24,15 +24,68 @@ partition by list (a)
(partition p0 values in (null));
#
-# Bug#27816: Log tables ran with partitions crashes the server when logging
-# is enabled.
+# Bug #27816: Log tables ran with partitions crashes the server when logging
+# is enabled.
#
+
USE mysql;
+TRUNCATE TABLE general_log;
+SET @old_general_log_state = @@global.general_log;
SET GLOBAL general_log = 0;
ALTER TABLE general_log ENGINE = MyISAM;
--error ER_WRONG_USAGE
ALTER TABLE general_log PARTITION BY RANGE (TO_DAYS(event_time))
- (PARTITION p0 VALUES LESS THAN (733144),
- PARTITION p1 VALUES LESS THAN (3000000));
+ (PARTITION p0 VALUES LESS THAN (733144), PARTITION p1 VALUES LESS THAN (3000000));
ALTER TABLE general_log ENGINE = CSV;
+SET GLOBAL general_log = @old_general_log_state;
+use test;
+
+--echo #
+--echo # Bug#40281: partitioning the general log table crashes the server
+--echo #
+
+--echo # set up partitioned log, and switch to it
+
+USE mysql;
+SET @old_general_log_state = @@global.general_log;
+SET GLOBAL general_log = 0;
+CREATE TABLE gl_partitioned LIKE general_log;
+ALTER TABLE gl_partitioned ENGINE=myisam;
+ALTER TABLE gl_partitioned PARTITION BY HASH (thread_id) PARTITIONS 10;
+ALTER TABLE general_log RENAME TO gl_nonpartitioned;
+ALTER TABLE gl_partitioned RENAME TO general_log;
+
+SELECT @@global.log_output INTO @old_glo;
+SET GLOBAL log_output='table';
+SET GLOBAL general_log =1;
+
+--echo # do some things to be logged to partitioned log, should fail
+USE /* 1 */ test;
+
+CREATE TABLE t1 (i INT);
+
+connect (con1,localhost,root,,);
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1;
+disconnect con1;
+
+connection default;
+USE mysql;
+SET GLOBAL general_log =0;
+ALTER TABLE general_log RENAME TO gl_partitioned;
+ALTER TABLE gl_nonpartitioned RENAME TO general_log;
+
+--echo # show whether we actually logged anything (no) to general_log
+SELECT COUNT(argument) FROM gl_partitioned;
+
+DROP TABLE gl_partitioned;
+
+SET GLOBAL log_output = @old_glo;
SET GLOBAL general_log = 1;
+
+USE /* 2 */ test;
+DROP TABLE t1;
+
+SET GLOBAL general_log = @old_general_log_state;
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/sp_notembedded.test b/mysql-test/t/sp_notembedded.test
index ecb37c1299c..f593e184ad2 100644
--- a/mysql-test/t/sp_notembedded.test
+++ b/mysql-test/t/sp_notembedded.test
@@ -380,3 +380,39 @@ set @@global.concurrent_insert= @old_concurrent_insert;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
+
+--echo #
+--echo # Bug#44521 Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al.
+--echo #
+SELECT GET_LOCK('Bug44521', 0);
+--connect (con1,localhost,root,,)
+--echo ** Connection con1
+delimiter $;
+CREATE PROCEDURE p()
+BEGIN
+ SELECT 1;
+ SELECT GET_LOCK('Bug44521', 100);
+ SELECT 2;
+END$
+delimiter ;$
+--send CALL p();
+--connection default
+--echo ** Default connection
+let $wait_condition=
+ SELECT count(*) = 1 FROM information_schema.processlist
+ WHERE state = "User lock" AND info = "SELECT GET_LOCK('Bug44521', 100)";
+--source include/wait_condition.inc
+let $conid =
+ `SELECT id FROM information_schema.processlist
+ WHERE state = "User lock" AND info = "SELECT GET_LOCK('Bug44521', 100)"`;
+dirty_close con1;
+SELECT RELEASE_LOCK('Bug44521');
+let $wait_condition=
+ SELECT count(*) = 0 FROM information_schema.processlist
+ WHERE id = $conid;
+--source include/wait_condition.inc
+DROP PROCEDURE p;
+
+--echo # ------------------------------------------------------------------
+--echo # -- End of 5.1 tests
+--echo # ------------------------------------------------------------------
diff --git a/mysys/Makefile.am b/mysys/Makefile.am
index 3312c692c09..8fea7fff4b0 100644
--- a/mysys/Makefile.am
+++ b/mysys/Makefile.am
@@ -63,7 +63,7 @@ libmysys_a_LIBADD = @THREAD_LOBJECTS@
# test_charset_DEPENDENCIES= $(LIBRARIES)
# charset2html_DEPENDENCIES= $(LIBRARIES)
DEFS = -DDEFAULT_BASEDIR=\"$(prefix)\" \
- -DDATADIR="\"$(MYSQLDATAdir)\"" \
+ -DMYSQL_DATADIR="\"$(MYSQLDATAdir)\"" \
-DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
-DDEFAULT_HOME_ENV=MYSQL_HOME \
diff --git a/sql/Makefile.am b/sql/Makefile.am
index e477a6123ec..2a12de2eaf6 100644
--- a/sql/Makefile.am
+++ b/sql/Makefile.am
@@ -137,7 +137,7 @@ mysql_tzinfo_to_sql_CXXFLAGS= -DTZINFO2SQL
DEFS = -DMYSQL_SERVER \
-DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
- -DDATADIR="\"$(MYSQLDATAdir)\"" \
+ -DMYSQL_DATADIR="\"$(MYSQLDATAdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
-DPLUGINDIR="\"$(pkgplugindir)\"" \
-DHAVE_EVENT_SCHEDULER \
diff --git a/sql/field.cc b/sql/field.cc
index ed085de1db3..452dfc3ae55 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -6271,48 +6271,15 @@ check_string_copy_error(Field_str *field,
const char *end,
CHARSET_INFO *cs)
{
- const char *pos, *end_orig;
- char tmp[64], *t;
+ const char *pos;
+ char tmp[32];
if (!(pos= well_formed_error_pos) &&
!(pos= cannot_convert_error_pos))
return FALSE;
- end_orig= end;
- set_if_smaller(end, pos + 6);
+ convert_to_printable(tmp, sizeof(tmp), pos, (end - pos), cs, 6);
- for (t= tmp; pos < end; pos++)
- {
- /*
- If the source string is ASCII compatible (mbminlen==1)
- and the source character is in ASCII printable range (0x20..0x7F),
- then display the character as is.
-
- Otherwise, if the source string is not ASCII compatible (e.g. UCS2),
- or the source character is not in the printable range,
- then print the character using HEX notation.
- */
- if (((unsigned char) *pos) >= 0x20 &&
- ((unsigned char) *pos) <= 0x7F &&
- cs->mbminlen == 1)
- {
- *t++= *pos;
- }
- else
- {
- *t++= '\\';
- *t++= 'x';
- *t++= _dig_vec_upper[((unsigned char) *pos) >> 4];
- *t++= _dig_vec_upper[((unsigned char) *pos) & 15];
- }
- }
- if (end_orig > end)
- {
- *t++= '.';
- *t++= '.';
- *t++= '.';
- }
- *t= '\0';
push_warning_printf(field->table->in_use,
field->table->in_use->abort_on_warning ?
MYSQL_ERROR::WARN_LEVEL_ERROR :
diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc
index a3adbe4a952..d9a9738ce72 100644
--- a/sql/ha_ndbcluster_binlog.cc
+++ b/sql/ha_ndbcluster_binlog.cc
@@ -3753,7 +3753,6 @@ pthread_handler_t ndb_binlog_thread_func(void *arg)
if (ndbcluster_terminating)
{
pthread_mutex_unlock(&LOCK_server_started);
- pthread_mutex_lock(&LOCK_ndb_util_thread);
goto err;
}
}
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 06fb9e32e35..562716a7db7 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -5414,6 +5414,13 @@ int ha_partition::extra(enum ha_extra_function operation)
/* Currently only NDB use the *_CANNOT_BATCH */
break;
}
+ /*
+ http://dev.mysql.com/doc/refman/5.1/en/partitioning-limitations.html
+ says we no longer support logging to partitioned tables, so we fail
+ here.
+ */
+ case HA_EXTRA_MARK_AS_LOG_TABLE:
+ DBUG_RETURN(ER_UNSUPORTED_LOG_ENGINE);
default:
{
/* Temporary crash to discover what is wrong */
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index d76a897519c..85139eb8b09 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -3519,7 +3519,7 @@ static int init_thread_environment()
(void) pthread_mutex_init(&LOCK_mysql_create_db,MY_MUTEX_INIT_SLOW);
(void) pthread_mutex_init(&LOCK_lock_db,MY_MUTEX_INIT_SLOW);
(void) pthread_mutex_init(&LOCK_Acl,MY_MUTEX_INIT_SLOW);
- (void) pthread_mutex_init(&LOCK_open, NULL);
+ (void) pthread_mutex_init(&LOCK_open, MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_thread_count,MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_mapped_file,MY_MUTEX_INIT_SLOW);
(void) pthread_mutex_init(&LOCK_status,MY_MUTEX_INIT_FAST);
@@ -6641,7 +6641,7 @@ The minimum value for this variable is 4096.",
"Joins that are probably going to read more than max_join_size records return an error.",
(uchar**) &global_system_variables.max_join_size,
(uchar**) &max_system_variables.max_join_size, 0, GET_HA_ROWS, REQUIRED_ARG,
- ~0L, 1, ~0L, 0, 1, 0},
+ HA_POS_ERROR, 1, HA_POS_ERROR, 0, 1, 0},
{"max_length_for_sort_data", OPT_MAX_LENGTH_FOR_SORT_DATA,
"Max number of bytes in sorted records.",
(uchar**) &global_system_variables.max_length_for_sort_data,
@@ -7650,7 +7650,7 @@ static int mysql_init_variables(void)
/* Set directory paths */
strmake(language, LANGUAGE, sizeof(language)-1);
- strmake(mysql_real_data_home, get_relative_path(DATADIR),
+ strmake(mysql_real_data_home, get_relative_path(MYSQL_DATADIR),
sizeof(mysql_real_data_home)-1);
mysql_data_home_buff[0]=FN_CURLIB; // all paths are relative from here
mysql_data_home_buff[1]=0;
diff --git a/sql/protocol.cc b/sql/protocol.cc
index 16975c68a54..4f69a0fdb52 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -29,11 +29,11 @@
static const unsigned int PACKET_BUFFER_EXTRA_ALLOC= 1024;
/* Declared non-static only because of the embedded library. */
-void net_send_error_packet(THD *thd, uint sql_errno, const char *err);
-void net_send_ok(THD *, uint, uint, ha_rows, ulonglong, const char *);
-void net_send_eof(THD *thd, uint server_status, uint total_warn_count);
+bool net_send_error_packet(THD *thd, uint sql_errno, const char *err);
+bool net_send_ok(THD *, uint, uint, ha_rows, ulonglong, const char *);
+bool net_send_eof(THD *thd, uint server_status, uint total_warn_count);
#ifndef EMBEDDED_LIBRARY
-static void write_eof_packet(THD *thd, NET *net,
+static bool write_eof_packet(THD *thd, NET *net,
uint server_status, uint total_warn_count);
#endif
@@ -70,8 +70,17 @@ bool Protocol_binary::net_store_data(const uchar *from, size_t length)
For SIGNAL/RESIGNAL and GET DIAGNOSTICS functionality it's
critical that every error that can be intercepted is issued in one
place only, my_message_sql.
+
+ @param thd Thread handler
+ @param sql_errno The error code to send
+ @param err A pointer to the error message
+
+ @return
+ @retval FALSE The message was sent to the client
+ @retval TRUE An error occurred and the message wasn't sent properly
*/
-void net_send_error(THD *thd, uint sql_errno, const char *err)
+
+bool net_send_error(THD *thd, uint sql_errno, const char *err)
{
DBUG_ENTER("net_send_error");
@@ -80,6 +89,7 @@ void net_send_error(THD *thd, uint sql_errno, const char *err)
DBUG_ASSERT(err && err[0]);
DBUG_PRINT("enter",("sql_errno: %d err: %s", sql_errno, err));
+ bool error;
/*
It's one case when we can push an error even though there
@@ -90,11 +100,11 @@ void net_send_error(THD *thd, uint sql_errno, const char *err)
/* Abort multi-result sets */
thd->server_status&= ~SERVER_MORE_RESULTS_EXISTS;
- net_send_error_packet(thd, sql_errno, err);
+ error= net_send_error_packet(thd, sql_errno, err);
thd->main_da.can_overwrite_status= FALSE;
- DBUG_VOID_RETURN;
+ DBUG_RETURN(error);
}
/**
@@ -113,25 +123,33 @@ void net_send_error(THD *thd, uint sql_errno, const char *err)
Is not stored if no message.
@param thd Thread handler
+ @param server_status The server status
+ @param total_warn_count Total number of warnings
@param affected_rows Number of rows changed by statement
@param id Auto_increment id for first row (if used)
@param message Message to send to the client (Used by mysql_status)
+
+ @return
+ @retval FALSE The message was successfully sent
+ @retval TRUE An error occurred and the messages wasn't sent properly
+
*/
#ifndef EMBEDDED_LIBRARY
-void
+bool
net_send_ok(THD *thd,
uint server_status, uint total_warn_count,
ha_rows affected_rows, ulonglong id, const char *message)
{
NET *net= &thd->net;
uchar buff[MYSQL_ERRMSG_SIZE+10],*pos;
+ bool error= FALSE;
DBUG_ENTER("my_ok");
if (! net->vio) // hack for re-parsing queries
{
DBUG_PRINT("info", ("vio present: NO"));
- DBUG_VOID_RETURN;
+ DBUG_RETURN(FALSE);
}
buff[0]=0; // No fields
@@ -162,13 +180,14 @@ net_send_ok(THD *thd,
if (message && message[0])
pos= net_store_data(pos, (uchar*) message, strlen(message));
- VOID(my_net_write(net, buff, (size_t) (pos-buff)));
- VOID(net_flush(net));
+ error= my_net_write(net, buff, (size_t) (pos-buff));
+ if (!error)
+ error= net_flush(net);
thd->main_da.can_overwrite_status= FALSE;
DBUG_PRINT("info", ("OK sent, so no more error sending allowed"));
- DBUG_VOID_RETURN;
+ DBUG_RETURN(error);
}
static uchar eof_buff[1]= { (uchar) 254 }; /* Marker for end of fields */
@@ -188,37 +207,54 @@ static uchar eof_buff[1]= { (uchar) 254 }; /* Marker for end of fields */
client.
@param thd Thread handler
- @param no_flush Set to 1 if there will be more data to the client,
- like in send_fields().
+ @param server_status The server status
+ @param total_warn_count Total number of warnings
+
+ @return
+ @retval FALSE The message was successfully sent
+ @retval TRUE An error occurred and the message wasn't sent properly
*/
-void
+bool
net_send_eof(THD *thd, uint server_status, uint total_warn_count)
{
NET *net= &thd->net;
+ bool error= FALSE;
DBUG_ENTER("net_send_eof");
/* Set to TRUE if no active vio, to work well in case of --init-file */
if (net->vio != 0)
{
thd->main_da.can_overwrite_status= TRUE;
- write_eof_packet(thd, net, server_status, total_warn_count);
- VOID(net_flush(net));
+ error= write_eof_packet(thd, net, server_status, total_warn_count);
+ if (!error)
+ error= net_flush(net);
thd->main_da.can_overwrite_status= FALSE;
DBUG_PRINT("info", ("EOF sent, so no more error sending allowed"));
}
- DBUG_VOID_RETURN;
+ DBUG_RETURN(error);
}
/**
Format EOF packet according to the current protocol and
write it to the network output buffer.
+
+ @param thd The thread handler
+ @param net The network handler
+ @param server_status The server status
+ @param total_warn_count The number of warnings
+
+
+ @return
+ @retval FALSE The message was sent successfully
+ @retval TRUE An error occurred and the messages wasn't sent properly
*/
-static void write_eof_packet(THD *thd, NET *net,
+static bool write_eof_packet(THD *thd, NET *net,
uint server_status,
uint total_warn_count)
{
+ bool error;
if (thd->client_capabilities & CLIENT_PROTOCOL_41)
{
uchar buff[5];
@@ -237,10 +273,12 @@ static void write_eof_packet(THD *thd, NET *net,
if (thd->is_fatal_error)
server_status&= ~SERVER_MORE_RESULTS_EXISTS;
int2store(buff + 3, server_status);
- VOID(my_net_write(net, buff, 5));
+ error= my_net_write(net, buff, 5);
}
else
- VOID(my_net_write(net, eof_buff, 1));
+ error= my_net_write(net, eof_buff, 1);
+
+ return error;
}
/**
@@ -261,7 +299,17 @@ bool send_old_password_request(THD *thd)
}
-void net_send_error_packet(THD *thd, uint sql_errno, const char *err)
+/**
+ @param thd Thread handler
+ @param sql_errno The error code to send
+ @param err A pointer to the error message
+
+ @return
+ @retval FALSE The message was successfully sent
+ @retval TRUE An error occurred and the messages wasn't sent properly
+*/
+
+bool net_send_error_packet(THD *thd, uint sql_errno, const char *err)
{
NET *net= &thd->net;
uint length;
@@ -279,7 +327,7 @@ void net_send_error_packet(THD *thd, uint sql_errno, const char *err)
/* In bootstrap it's ok to print on stderr */
fprintf(stderr,"ERROR: %d %s\n",sql_errno,err);
}
- DBUG_VOID_RETURN;
+ DBUG_RETURN(FALSE);
}
if (net->return_errno)
@@ -301,9 +349,8 @@ void net_send_error_packet(THD *thd, uint sql_errno, const char *err)
length=(uint) strlen(err);
set_if_smaller(length,MYSQL_ERRMSG_SIZE-1);
}
- VOID(net_write_command(net,(uchar) 255, (uchar*) "", 0, (uchar*) err,
+ DBUG_RETURN(net_write_command(net,(uchar) 255, (uchar*) "", 0, (uchar*) err,
length));
- DBUG_VOID_RETURN;
}
#endif /* EMBEDDED_LIBRARY */
@@ -389,36 +436,39 @@ void net_end_statement(THD *thd)
if (thd->main_da.is_sent)
return;
+ bool error= FALSE;
+
switch (thd->main_da.status()) {
case Diagnostics_area::DA_ERROR:
/* The query failed, send error to log and abort bootstrap. */
- net_send_error(thd,
- thd->main_da.sql_errno(),
- thd->main_da.message());
+ error= net_send_error(thd,
+ thd->main_da.sql_errno(),
+ thd->main_da.message());
break;
case Diagnostics_area::DA_EOF:
- net_send_eof(thd,
- thd->main_da.server_status(),
- thd->main_da.total_warn_count());
+ error= net_send_eof(thd,
+ thd->main_da.server_status(),
+ thd->main_da.total_warn_count());
break;
case Diagnostics_area::DA_OK:
- net_send_ok(thd,
- thd->main_da.server_status(),
- thd->main_da.total_warn_count(),
- thd->main_da.affected_rows(),
- thd->main_da.last_insert_id(),
- thd->main_da.message());
+ error= net_send_ok(thd,
+ thd->main_da.server_status(),
+ thd->main_da.total_warn_count(),
+ thd->main_da.affected_rows(),
+ thd->main_da.last_insert_id(),
+ thd->main_da.message());
break;
case Diagnostics_area::DA_DISABLED:
break;
case Diagnostics_area::DA_EMPTY:
default:
DBUG_ASSERT(0);
- net_send_ok(thd, thd->server_status, thd->total_warn_count,
- 0, 0, NULL);
+ error= net_send_ok(thd, thd->server_status, thd->total_warn_count,
+ 0, 0, NULL);
break;
}
- thd->main_da.is_sent= TRUE;
+ if (!error)
+ thd->main_da.is_sent= TRUE;
}
diff --git a/sql/protocol.h b/sql/protocol.h
index a4770e9b6e3..251ba6fbc33 100644
--- a/sql/protocol.h
+++ b/sql/protocol.h
@@ -173,7 +173,7 @@ public:
};
void send_warning(THD *thd, uint sql_errno, const char *err=0);
-void net_send_error(THD *thd, uint sql_errno=0, const char *err=0);
+bool net_send_error(THD *thd, uint sql_errno=0, const char *err=0);
void net_end_statement(THD *thd);
bool send_old_password_request(THD *thd);
uchar *net_store_data(uchar *to,const uchar *from, size_t length);
diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt
index 8cf2fa2463d..5531ee71620 100644
--- a/sql/share/errmsg.txt
+++ b/sql/share/errmsg.txt
@@ -6203,3 +6203,6 @@ ER_RENAMED_NAME
swe "Namnndrad"
ER_TOO_MANY_CONCURRENT_TRXS
eng "Too many active concurrent transactions"
+
+WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED
+ eng "Non-ASCII separator arguments are not fully supported"
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 018937fec2f..0736e5fc2a8 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -1248,7 +1248,7 @@ sp_head::execute(THD *thd)
*/
if (thd->prelocked_mode == NON_PRELOCKED)
thd->user_var_events_alloc= thd->mem_root;
-
+
err_status= i->execute(thd, &ip);
if (i->free_list)
@@ -2863,7 +2863,7 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
if (!thd->is_error())
thd->main_da.reset_diagnostics_area();
}
- DBUG_RETURN(res);
+ DBUG_RETURN(res || thd->is_error());
}
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 54684e4987e..a9c399e15de 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -1790,6 +1790,8 @@ select_export::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
if ((uint) strlen(exchange->file_name) + NAME_LEN >= FN_REFLEN)
strmake(path,exchange->file_name,FN_REFLEN-1);
+ write_cs= exchange->cs ? exchange->cs : &my_charset_bin;
+
if ((file= create_file(thd, path, exchange, &cache)) < 0)
return 1;
/* Check if there is any blobs in data */
@@ -1809,6 +1811,31 @@ select_export::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
non_string_results= TRUE;
}
}
+ if (exchange->escaped->numchars() > 1 || exchange->enclosed->numchars() > 1)
+ {
+ my_error(ER_WRONG_FIELD_TERMINATORS, MYF(0));
+ return TRUE;
+ }
+ if (exchange->escaped->length() > 1 || exchange->enclosed->length() > 1 ||
+ !my_isascii(exchange->escaped->ptr()[0]) ||
+ !my_isascii(exchange->enclosed->ptr()[0]) ||
+ !exchange->field_term->is_ascii() || !exchange->line_term->is_ascii() ||
+ !exchange->line_start->is_ascii())
+ {
+ /*
+ Current LOAD DATA INFILE recognizes field/line separators "as is" without
+ converting from client charset to data file charset. So, it is supposed,
+ that input file of LOAD DATA INFILE consists of data in one charset and
+ separators in other charset. For the compatibility with that [buggy]
+ behaviour SELECT INTO OUTFILE implementation has been saved "as is" too,
+ but the new warning message has been added:
+
+ Non-ASCII separator arguments are not fully supported
+ */
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED,
+ ER(WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED));
+ }
field_term_length=exchange->field_term->length();
field_term_char= field_term_length ?
(int) (uchar) (*exchange->field_term)[0] : INT_MAX;
@@ -1858,6 +1885,8 @@ bool select_export::send_data(List<Item> &items)
DBUG_ENTER("select_export::send_data");
char buff[MAX_FIELD_WIDTH],null_buff[2],space[MAX_FIELD_WIDTH];
+ char cvt_buff[MAX_FIELD_WIDTH];
+ String cvt_str(cvt_buff, sizeof(cvt_buff), write_cs);
bool space_inited=0;
String tmp(buff,sizeof(buff),&my_charset_bin),*res;
tmp.length(0);
@@ -1881,6 +1910,37 @@ bool select_export::send_data(List<Item> &items)
bool enclosed = (exchange->enclosed->length() &&
(!exchange->opt_enclosed || result_type == STRING_RESULT));
res=item->str_result(&tmp);
+ if (res && !my_charset_same(write_cs, res->charset()) &&
+ !my_charset_same(write_cs, &my_charset_bin))
+ {
+ const char *well_formed_error_pos;
+ const char *cannot_convert_error_pos;
+ const char *from_end_pos;
+ const char *error_pos;
+ uint32 bytes;
+ bytes= well_formed_copy_nchars(write_cs, cvt_buff, sizeof(cvt_buff),
+ res->charset(), res->ptr(), res->length(),
+ sizeof(cvt_buff),
+ &well_formed_error_pos,
+ &cannot_convert_error_pos,
+ &from_end_pos);
+ error_pos= well_formed_error_pos ? well_formed_error_pos
+ : cannot_convert_error_pos;
+ if (error_pos)
+ {
+ char printable_buff[32];
+ convert_to_printable(printable_buff, sizeof(printable_buff),
+ error_pos, res->ptr() + res->length() - error_pos,
+ res->charset(), 6);
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
+ ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
+ "string", printable_buff,
+ item->name, row_count);
+ }
+ cvt_str.length(bytes);
+ res= &cvt_str;
+ }
if (res && enclosed)
{
if (my_b_write(&cache,(uchar*) exchange->enclosed->ptr(),
@@ -3714,7 +3774,8 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
push_warning(this, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_BINLOG_UNSAFE_STATEMENT,
ER(ER_BINLOG_UNSAFE_STATEMENT));
- if (!(binlog_flags & BINLOG_FLAG_UNSAFE_STMT_PRINTED))
+ if (global_system_variables.log_warnings &&
+ !(binlog_flags & BINLOG_FLAG_UNSAFE_STMT_PRINTED))
{
sql_print_warning("%s Statement: %.*s",
ER(ER_BINLOG_UNSAFE_STATEMENT),
diff --git a/sql/sql_class.h b/sql/sql_class.h
index f1b56551b50..09841edc480 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -2493,6 +2493,7 @@ class select_export :public select_to_file {
*/
bool is_unsafe_field_sep;
bool fixed_row_size;
+ CHARSET_INFO *write_cs; // output charset
public:
select_export(sql_exchange *ex) :select_to_file(ex) {}
/**
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 1758a6df5f9..b7f33d51335 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -148,6 +148,17 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
MYF(0));
DBUG_RETURN(TRUE);
}
+
+ /* Report problems with non-ascii separators */
+ if (!escaped->is_ascii() || !enclosed->is_ascii() ||
+ !field_term->is_ascii() ||
+ !ex->line_term->is_ascii() || !ex->line_start->is_ascii())
+ {
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED,
+ ER(WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED));
+ }
+
if (open_and_lock_tables(thd, table_list))
DBUG_RETURN(TRUE);
if (setup_tables_and_check_access(thd, &thd->lex->select_lex.context,
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 284eaebbe87..a181a6b3f13 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -3824,8 +3824,13 @@ bool mysql_unpack_partition(THD *thd,
Item_field objects.
This is not a nice solution since if the parser uses current_select
for anything else it will corrupt the current LEX object.
+ Also, we need to make sure there even is a select -- if the statement
+ was a "USE ...", current_select will be NULL, but we may still end up
+ here if we try to log to a partitioned table. This is currently
+ unsupported, but should still fail rather than crash!
*/
- thd->lex->current_select= old_lex->current_select;
+ if (!(thd->lex->current_select= old_lex->current_select))
+ goto end;
/*
All Items created is put into a free list on the THD object. This list
is used to free all Item objects after completing a query. We don't
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index 7759985ba85..7c9793b273b 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -1119,3 +1119,76 @@ void String::swap(String &s)
swap_variables(bool, alloced, s.alloced);
swap_variables(CHARSET_INFO*, str_charset, s.str_charset);
}
+
+
+/**
+ Convert string to printable ASCII string
+
+ @details This function converts input string "from" replacing non-ASCII bytes
+ with hexadecimal sequences ("\xXX") optionally appending "..." to the end of
+ the resulting string.
+ This function used in the ER_TRUNCATED_WRONG_VALUE_FOR_FIELD error messages,
+ e.g. when a string cannot be converted to a result charset.
+
+
+ @param to output buffer
+ @param to_len size of the output buffer (8 bytes or greater)
+ @param from input string
+ @param from_len size of the input string
+ @param from_cs input charset
+ @param nbytes maximal number of bytes to convert (from_len if 0)
+
+ @return number of bytes in the output string
+*/
+
+uint convert_to_printable(char *to, size_t to_len,
+ const char *from, size_t from_len,
+ CHARSET_INFO *from_cs, size_t nbytes /*= 0*/)
+{
+ /* needs at least 8 bytes for '\xXX...' and zero byte */
+ DBUG_ASSERT(to_len >= 8);
+
+ char *t= to;
+ char *t_end= to + to_len - 1; // '- 1' is for the '\0' at the end
+ const char *f= from;
+ const char *f_end= from + (nbytes ? min(from_len, nbytes) : from_len);
+ char *dots= to; // last safe place to append '...'
+
+ if (!f || t == t_end)
+ return 0;
+
+ for (; t < t_end && f < f_end; f++)
+ {
+ /*
+ If the source string is ASCII compatible (mbminlen==1)
+ and the source character is in ASCII printable range (0x20..0x7F),
+ then display the character as is.
+
+ Otherwise, if the source string is not ASCII compatible (e.g. UCS2),
+ or the source character is not in the printable range,
+ then print the character using HEX notation.
+ */
+ if (((unsigned char) *f) >= 0x20 &&
+ ((unsigned char) *f) <= 0x7F &&
+ from_cs->mbminlen == 1)
+ {
+ *t++= *f;
+ }
+ else
+ {
+ if (t_end - t < 4) // \xXX
+ break;
+ *t++= '\\';
+ *t++= 'x';
+ *t++= _dig_vec_upper[((unsigned char) *f) >> 4];
+ *t++= _dig_vec_upper[((unsigned char) *f) & 0x0F];
+ }
+ if (t_end - t >= 3) // '...'
+ dots= t;
+ }
+ if (f < from + from_len)
+ memcpy(dots, STRING_WITH_LEN("...\0"));
+ else
+ *t= '\0';
+ return t - to;
+}
diff --git a/sql/sql_string.h b/sql/sql_string.h
index be11fea70dc..d62908e5d66 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -40,6 +40,9 @@ uint32 well_formed_copy_nchars(CHARSET_INFO *to_cs,
size_t my_copy_with_hex_escaping(CHARSET_INFO *cs,
char *dst, size_t dstlen,
const char *src, size_t srclen);
+uint convert_to_printable(char *to, size_t to_len,
+ const char *from, size_t from_len,
+ CHARSET_INFO *from_cs, size_t nbytes= 0);
class String
{
@@ -366,6 +369,19 @@ public:
{
return (s->alloced && Ptr >= s->Ptr && Ptr < s->Ptr + s->str_length);
}
+ bool is_ascii() const
+ {
+ if (length() == 0)
+ return TRUE;
+ if (charset()->mbminlen > 1)
+ return FALSE;
+ for (const char *c= ptr(), *end= c + length(); c < end; c++)
+ {
+ if (!my_isascii(*c))
+ return FALSE;
+ }
+ return TRUE;
+ }
};
static inline bool check_if_only_end_space(CHARSET_INFO *cs, char *str,
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 096e7941d00..320b43c8e5c 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -9213,6 +9213,8 @@ into_destination:
!(lex->result= new select_export(lex->exchange, lex->nest_level)))
MYSQL_YYABORT;
}
+ opt_load_data_charset
+ { Lex->exchange->cs= $4; }
opt_field_term opt_line_term
| DUMPFILE TEXT_STRING_filesystem
{
diff --git a/sql/unireg.h b/sql/unireg.h
index 6f9c44d98f9..3ff7f058e3c 100644
--- a/sql/unireg.h
+++ b/sql/unireg.h
@@ -29,8 +29,8 @@
#define TEMP_PREFIX "MY"
#define LOG_PREFIX "ML"
#define PROGDIR "bin/"
-#ifndef DATADIR
-#define DATADIR "data/"
+#ifndef MYSQL_DATADIR
+#define MYSQL_DATADIR "data/"
#endif
#ifndef SHAREDIR
#define SHAREDIR "share/"
diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc
index 19510d0eae1..44469a03ce0 100644
--- a/storage/myisammrg/ha_myisammrg.cc
+++ b/storage/myisammrg/ha_myisammrg.cc
@@ -884,7 +884,6 @@ int ha_myisammrg::info(uint flag)
*/
mrg_info.errkey= MAX_KEY;
}
- errkey= mrg_info.errkey;
table->s->keys_in_use.set_prefix(table->s->keys);
stats.mean_rec_length= mrg_info.reclength;
@@ -934,6 +933,11 @@ int ha_myisammrg::info(uint flag)
min(file->keys, table->s->key_parts));
}
}
+ if (flag & HA_STATUS_ERRKEY)
+ {
+ errkey= mrg_info.errkey;
+ my_store_ptr(dup_ref, ref_length, mrg_info.dupp_key_pos);
+ }
return 0;
}
diff --git a/storage/myisammrg/ha_myisammrg.h b/storage/myisammrg/ha_myisammrg.h
index 21d41c9d75a..790aa15e90a 100644
--- a/storage/myisammrg/ha_myisammrg.h
+++ b/storage/myisammrg/ha_myisammrg.h
@@ -44,7 +44,8 @@ class ha_myisammrg: public handler
HA_NULL_IN_KEY | HA_CAN_INDEX_BLOBS | HA_FILE_BASED |
HA_ANY_INDEX_MAY_BE_UNIQUE | HA_CAN_BIT_FIELD |
HA_HAS_RECORDS |
- HA_NO_COPY_ON_ALTER);
+ HA_NO_COPY_ON_ALTER |
+ HA_DUPLICATE_POS);
}
ulong index_flags(uint inx, uint part, bool all_parts) const
{
diff --git a/storage/myisammrg/myrg_info.c b/storage/myisammrg/myrg_info.c
index 7ea2dbf58e3..1930351ec8f 100644
--- a/storage/myisammrg/myrg_info.c
+++ b/storage/myisammrg/myrg_info.c
@@ -58,9 +58,27 @@ int myrg_status(MYRG_INFO *info,register MYMERGE_INFO *x,int flag)
x->reclength= info->reclength;
x->options= info->options;
if (current_table)
+ {
+ /*
+ errkey is set to the index number of the myisam tables. But
+ since the MERGE table can have less keys than the MyISAM
+ tables, errkey cannot be be used as an index into the key_info
+ on the server. This value will be overwritten with MAX_KEY by
+ the MERGE engine.
+ */
x->errkey= current_table->table->errkey;
+ /*
+ Calculate the position of the duplicate key to be the sum of the
+ offset of the myisam file and the offset into the file at which
+ the duplicate key is located.
+ */
+ x->dupp_key_pos= current_table->file_offset + current_table->table->dupp_key_pos;
+ }
else
+ {
x->errkey= 0;
+ x->dupp_key_pos= 0;
+ }
x->rec_per_key = info->rec_per_key_part;
}
DBUG_RETURN(0);
diff --git a/storage/ndb/src/mgmsrv/Makefile.am b/storage/ndb/src/mgmsrv/Makefile.am
index c19f885ae8d..3f37280d7a5 100644
--- a/storage/ndb/src/mgmsrv/Makefile.am
+++ b/storage/ndb/src/mgmsrv/Makefile.am
@@ -48,7 +48,7 @@ LDADD_LOC = $(top_builddir)/storage/ndb/src/mgmclient/CommandInterpreter.lo \
@TERMCAP_LIB@
DEFS_LOC = -DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
- -DDATADIR="\"$(MYSQLDATAdir)\"" \
+ -DMYSQL_DATADIR="\"$(MYSQLDATAdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
-DMYSQLCLUSTERDIR="\"$(MYSQLCLUSTERdir)\""