summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/insert.result28
-rw-r--r--mysql-test/t/insert.test29
-rw-r--r--plugin/server_audit/server_audit.c10
-rw-r--r--sql/table.cc8
-rw-r--r--sql/wsrep_binlog.cc2
5 files changed, 72 insertions, 5 deletions
diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result
index c9e3dc7b253..8e572c5fede 100644
--- a/mysql-test/r/insert.result
+++ b/mysql-test/r/insert.result
@@ -717,3 +717,31 @@ insert ignore into t1 values (1,12);
Warnings:
Warning 1062 Duplicate entry '1' for key 'f1'
DROP TABLE t1;
+#
+# MDEV-13290 Assertion Assertion `!is_set() || (m_status == DA_OK_BULK
+# && is_bulk_op())' or `! is_set()' failed
+#
+SET @save_mode= @@sql_mode;
+SET sql_mode= 'STRICT_ALL_TABLES';
+CREATE TABLE t1 (f1 INT DEFAULT 0, f2 INT);
+CREATE ALGORITHM = MERGE VIEW v1 AS SELECT f1, f2 FROM t1 WHERE f1 = 'x' WITH CHECK OPTION;
+REPLACE INTO v1 SET f2 = 1;
+ERROR 22007: Truncated incorrect DOUBLE value: 'x'
+SELECT * from t1;
+f1 f2
+drop view v1;
+CREATE ALGORITHM = MERGE VIEW v1 AS SELECT f1, f2 FROM t1 WHERE f1 = cast('' as decimal) WITH CHECK OPTION;
+REPLACE INTO v1 SET f2 = 1;
+ERROR 22007: Truncated incorrect DECIMAL value: ''
+SELECT * from t1;
+f1 f2
+drop view v1;
+SELECT 0,0 INTO OUTFILE 't1.txt';
+CREATE ALGORITHM = MERGE VIEW v1 AS SELECT f1, f2 FROM t1 WHERE f1 = 'x' WITH CHECK OPTION;
+LOAD DATA INFILE 't1.txt' INTO TABLE v1;
+ERROR 22007: Truncated incorrect DOUBLE value: 'x'
+SELECT * from t1;
+f1 f2
+drop view v1;
+drop table t1;
+SET @@sql_mode= @save_mode;
diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test
index 206c5553100..80caefa5a0f 100644
--- a/mysql-test/t/insert.test
+++ b/mysql-test/t/insert.test
@@ -573,3 +573,32 @@ insert ignore into t1 values (1,12) on duplicate key update f2=13;
set @@old_mode="";
insert ignore into t1 values (1,12);
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-13290 Assertion Assertion `!is_set() || (m_status == DA_OK_BULK
+--echo # && is_bulk_op())' or `! is_set()' failed
+--echo #
+
+SET @save_mode= @@sql_mode;
+SET sql_mode= 'STRICT_ALL_TABLES';
+CREATE TABLE t1 (f1 INT DEFAULT 0, f2 INT);
+CREATE ALGORITHM = MERGE VIEW v1 AS SELECT f1, f2 FROM t1 WHERE f1 = 'x' WITH CHECK OPTION;
+--error ER_TRUNCATED_WRONG_VALUE
+REPLACE INTO v1 SET f2 = 1;
+SELECT * from t1;
+drop view v1;
+CREATE ALGORITHM = MERGE VIEW v1 AS SELECT f1, f2 FROM t1 WHERE f1 = cast('' as decimal) WITH CHECK OPTION;
+--error ER_TRUNCATED_WRONG_VALUE
+REPLACE INTO v1 SET f2 = 1;
+SELECT * from t1;
+drop view v1;
+SELECT 0,0 INTO OUTFILE 't1.txt';
+CREATE ALGORITHM = MERGE VIEW v1 AS SELECT f1, f2 FROM t1 WHERE f1 = 'x' WITH CHECK OPTION;
+--error ER_TRUNCATED_WRONG_VALUE
+LOAD DATA INFILE 't1.txt' INTO TABLE v1;
+SELECT * from t1;
+let $MYSQLD_DATADIR= `select @@datadir`;
+remove_file $MYSQLD_DATADIR/test/t1.txt;
+drop view v1;
+drop table t1;
+SET @@sql_mode= @save_mode;
diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c
index 65de695ac9e..51f616b9af4 100644
--- a/plugin/server_audit/server_audit.c
+++ b/plugin/server_audit/server_audit.c
@@ -15,7 +15,7 @@
#define PLUGIN_VERSION 0x104
-#define PLUGIN_STR_VERSION "1.4.1"
+#define PLUGIN_STR_VERSION "1.4.2"
#define _my_thread_var loc_thread_var
@@ -1089,6 +1089,7 @@ static void setup_connection_connect(struct connection_info *cn,
const struct mysql_event_connection *event)
{
cn->query_id= 0;
+ cn->query_length= 0;
cn->log_always= 0;
cn->thread_id= event->thread_id;
get_str_n(cn->db, &cn->db_length, sizeof(cn->db),
@@ -1130,6 +1131,7 @@ static void setup_connection_initdb(struct connection_info *cn,
cn->thread_id= event->general_thread_id;
cn->query_id= 0;
+ cn->query_length= 0;
cn->log_always= 0;
get_str_n(cn->db, &cn->db_length, sizeof(cn->db),
event->general_query, event->general_query_length);
@@ -1162,6 +1164,7 @@ static void setup_connection_table(struct connection_info *cn,
cn->thread_id= event->thread_id;
cn->query_id= query_counter++;
cn->log_always= 0;
+ cn->query_length= 0;
get_str_n(cn->db, &cn->db_length, sizeof(cn->db),
event->database, event->database_length);
get_str_n(cn->user, &cn->user_length, sizeof(cn->db),
@@ -1183,6 +1186,7 @@ static void setup_connection_query(struct connection_info *cn,
cn->thread_id= event->general_thread_id;
cn->query_id= query_counter++;
cn->log_always= 0;
+ cn->query_length= 0;
get_str_n(cn->db, &cn->db_length, sizeof(cn->db), "", 0);
if (get_user_host(event->general_user, event->general_user_length,
@@ -2007,6 +2011,7 @@ void auditing(MYSQL_THD thd, unsigned int event_class, const void *ev)
event_query_command(event))
{
log_statement(cn, event, "QUERY");
+ cn->query_length= 0; /* So the log_current_query() won't log this again. */
}
}
else if (event_class == MYSQL_AUDIT_TABLE_CLASS && FILTER(EVENT_TABLE) && cn)
@@ -2522,7 +2527,8 @@ static void log_current_query(MYSQL_THD thd)
if (!thd)
return;
cn= get_loc_info(thd);
- if (!ci_needs_setup(cn) && FILTER(EVENT_QUERY) && do_log_user(cn->user))
+ if (!ci_needs_setup(cn) && cn->query_length &&
+ FILTER(EVENT_QUERY) && do_log_user(cn->user))
{
log_statement_ex(cn, cn->query_time, thd_get_thread_id(thd),
cn->query, cn->query_length, 0, "QUERY");
diff --git a/sql/table.cc b/sql/table.cc
index a612772b39f..b82228a257a 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -5078,7 +5078,11 @@ int TABLE_LIST::view_check_option(THD *thd, bool ignore_failure)
name_db, name_table);
return ignore_failure ? VIEW_CHECK_SKIP : VIEW_CHECK_ERROR;
}
- return table->verify_constraints(ignore_failure);
+ int result= table->verify_constraints(ignore_failure);
+ /* We check thd->error() because it can be set by conversion problem. */
+ if (thd->is_error())
+ return(VIEW_CHECK_ERROR);
+ return result;
}
@@ -5100,7 +5104,7 @@ int TABLE::verify_constraints(bool ignore_failure)
}
}
}
- return VIEW_CHECK_OK;
+ return(VIEW_CHECK_OK);
}
diff --git a/sql/wsrep_binlog.cc b/sql/wsrep_binlog.cc
index d538383ebc4..483da2296ad 100644
--- a/sql/wsrep_binlog.cc
+++ b/sql/wsrep_binlog.cc
@@ -452,7 +452,7 @@ void wsrep_dump_rbr_buf_with_header(THD *thd, const void *rbr_buf,
File file;
IO_CACHE cache;
Log_event_writer writer(&cache);
- Format_description_log_event *ev;
+ Format_description_log_event *ev=NULL;
int len= my_snprintf(filename, PATH_MAX, "%s/GRA_%lld_%lld_v2.log",
wsrep_data_home_dir, (longlong) thd->thread_id,