summaryrefslogtreecommitdiffstats
path: root/plugin
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--plugin/auth_pam/auth_pam.c1
-rw-r--r--plugin/auth_pam/testing/pam_mariadb_mtr.c2
-rw-r--r--plugin/disks/CMakeLists.txt5
-rw-r--r--plugin/disks/information_schema_disks.cc12
-rw-r--r--plugin/disks/mysql-test/disks/disks.result4
-rw-r--r--plugin/disks/mysql-test/disks/disks.test2
-rw-r--r--plugin/disks/mysql-test/disks/disks_notembedded.result8
-rw-r--r--plugin/disks/mysql-test/disks/disks_notembedded.test4
-rw-r--r--plugin/feedback/CMakeLists.txt2
-rw-r--r--plugin/feedback/sender_thread.cc2
-rw-r--r--plugin/file_key_management/parser.cc2
-rw-r--r--plugin/hashicorp_key_management/hashicorp_key_management_plugin.cc28
-rw-r--r--plugin/qc_info/CMakeLists.txt2
-rw-r--r--plugin/sql_errlog/sql_errlog.c45
-rw-r--r--plugin/test_sql_service/CMakeLists.txt2
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet4_myisam.result2
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6.result75
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6.test26
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_myisam.result2
-rw-r--r--plugin/type_mysql_json/type.cc7
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.result2
-rw-r--r--plugin/user_variables/user_variables.cc6
22 files changed, 185 insertions, 56 deletions
diff --git a/plugin/auth_pam/auth_pam.c b/plugin/auth_pam/auth_pam.c
index ffcfa019..86220f48 100644
--- a/plugin/auth_pam/auth_pam.c
+++ b/plugin/auth_pam/auth_pam.c
@@ -22,6 +22,7 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <spawn.h>
+#include <my_global.h>
#include <mysql/plugin_auth.h>
#include "auth_pam_tool.h"
diff --git a/plugin/auth_pam/testing/pam_mariadb_mtr.c b/plugin/auth_pam/testing/pam_mariadb_mtr.c
index 108aeb94..de34f5d8 100644
--- a/plugin/auth_pam/testing/pam_mariadb_mtr.c
+++ b/plugin/auth_pam/testing/pam_mariadb_mtr.c
@@ -10,8 +10,8 @@
#include <stdlib.h>
#include <string.h>
-#include <security/pam_modules.h>
#include <security/pam_appl.h>
+#include <security/pam_modules.h>
#define N 3
diff --git a/plugin/disks/CMakeLists.txt b/plugin/disks/CMakeLists.txt
index 4e40842c..408a4324 100644
--- a/plugin/disks/CMakeLists.txt
+++ b/plugin/disks/CMakeLists.txt
@@ -4,7 +4,8 @@ CHECK_SYMBOL_EXISTS (getmntent "mntent.h" HAVE_GETMNTENT)
CHECK_SYMBOL_EXISTS (getmntent "sys/mnttab.h" HAVE_GETMNTENT_IN_SYS_MNTAB)
CHECK_SYMBOL_EXISTS (setmntent "mntent.h" HAVE_SETMNTENT)
CHECK_SYMBOL_EXISTS (getmntinfo "sys/types.h;sys/mount.h" HAVE_GETMNTINFO)
-CHECK_SYMBOL_EXISTS (getmntinfo64 "sys/types.h;sys/mount.h" HAVE_GETMNTINFO64)
+
+CHECK_INCLUDE_FILES (sys/mntent.h HAVE_SYS_MNTENT_H)
IF (HAVE_GETMNTINFO)
CHECK_CXX_SOURCE_COMPILES("
@@ -18,7 +19,7 @@ int main()
" HAVE_GETMNTINFO_TAKES_statvfs)
ENDIF()
IF (HAVE_GETMNTENT OR HAVE_GETMNTENT_IN_SYS_MNTAB OR
- HAVE_GETMNTINFO OR HAVE_GETMNTINFO64)
+ HAVE_GETMNTINFO)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql)
MYSQL_ADD_PLUGIN(DISKS information_schema_disks.cc MODULE_ONLY RECOMPILE_FOR_EMBEDDED)
ENDIF()
diff --git a/plugin/disks/information_schema_disks.cc b/plugin/disks/information_schema_disks.cc
index 15e26dad..01df3259 100644
--- a/plugin/disks/information_schema_disks.cc
+++ b/plugin/disks/information_schema_disks.cc
@@ -19,7 +19,7 @@
#include <sys/types.h>
#if defined(HAVE_GETMNTENT)
#include <mntent.h>
-#elif !defined(HAVE_GETMNTINFO_TAKES_statvfs)
+#elif defined(HAVE_GETMNTINFO) && !defined(HAVE_GETMNTINFO_TAKES_statvfs)
/* getmntinfo (the not NetBSD variants) */
#include <sys/param.h>
#include <sys/ucred.h>
@@ -28,6 +28,9 @@
#if defined(HAVE_GETMNTENT_IN_SYS_MNTAB)
#include <sys/mnttab.h>
#define HAVE_GETMNTENT
+#if defined(HAVE_SYS_MNTENT_H)
+#include <sys/mntent.h>
+#endif
#endif
#include <sql_class.h>
#include <sql_i_s.h>
@@ -37,8 +40,7 @@
This intends to support *BSD's, macOS, Solaris, AIX, HP-UX, and Linux.
specificly:
- FreeBSD/OpenBSD/DragonFly (statfs) NetBSD (statvfs) uses getmntinfo().
- macOS uses getmntinfo64().
+ FreeBSD/OpenBSD/DragonFly/macOS (statfs) NetBSD (statvfs) uses getmntinfo().
Linux can use getmntent_r(), but we've just used getmntent for simplification.
Linux/Solaris/AIX/HP-UX uses setmntent()/getmntent().
Solaris uses getmntent() with a diffent prototype, return structure, and
@@ -46,8 +48,6 @@
*/
#if defined(HAVE_GETMNTINFO_TAKES_statvfs) || defined(HAVE_GETMNTENT)
typedef struct statvfs st_info;
-#elif defined(HAVE_GETMNTINFO64)
-typedef struct statfs64 st_info;
#else // GETMNTINFO
typedef struct statfs st_info;
#endif
@@ -150,8 +150,6 @@ static int disks_fill_table(THD* pThd, TABLE_LIST* pTables, Item* pCond)
#if defined(HAVE_GETMNTINFO_TAKES_statvfs)
count= getmntinfo(&s, ST_WAIT);
-#elif defined(HAVE_GETMNTINFO64)
- count= getmntinfo64(&s, MNT_WAIT);
#else
count= getmntinfo(&s, MNT_WAIT);
#endif
diff --git a/plugin/disks/mysql-test/disks/disks.result b/plugin/disks/mysql-test/disks/disks.result
index 888f2df6..e46390c7 100644
--- a/plugin/disks/mysql-test/disks/disks.result
+++ b/plugin/disks/mysql-test/disks/disks.result
@@ -7,6 +7,6 @@ DISKS CREATE TEMPORARY TABLE `DISKS` (
`Used` bigint(32) NOT NULL,
`Available` bigint(32) NOT NULL
) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
-select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
-sum(Total) > sum(Available) sum(Total)>sum(Used)
+select sum(Total) >= sum(Available), sum(Total)>=sum(Used) from information_schema.disks;
+sum(Total) >= sum(Available) sum(Total)>=sum(Used)
1 1
diff --git a/plugin/disks/mysql-test/disks/disks.test b/plugin/disks/mysql-test/disks/disks.test
index 7189c548..9adc3f01 100644
--- a/plugin/disks/mysql-test/disks/disks.test
+++ b/plugin/disks/mysql-test/disks/disks.test
@@ -1,3 +1,3 @@
--replace_regex /varchar\([0-9]+\)/varchar(pathlen)/
show create table information_schema.disks;
-select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
+select sum(Total) >= sum(Available), sum(Total)>=sum(Used) from information_schema.disks;
diff --git a/plugin/disks/mysql-test/disks/disks_notembedded.result b/plugin/disks/mysql-test/disks/disks_notembedded.result
index 97429474..ea2ccc85 100644
--- a/plugin/disks/mysql-test/disks/disks_notembedded.result
+++ b/plugin/disks/mysql-test/disks/disks_notembedded.result
@@ -6,16 +6,16 @@ CREATE USER user1@localhost;
GRANT SELECT ON *.* TO user1@localhost;
connect con1,localhost,user1,,;
connection con1;
-select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
-sum(Total) > sum(Available) sum(Total)>sum(Used)
+select sum(Total) >= sum(Available), sum(Total) >= sum(Used) from information_schema.disks;
+sum(Total) >= sum(Available) sum(Total) >= sum(Used)
NULL NULL
disconnect con1;
connection default;
GRANT FILE ON *.* TO user1@localhost;
connect con1,localhost,user1,,;
connection con1;
-select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
-sum(Total) > sum(Available) sum(Total)>sum(Used)
+select sum(Total) >= sum(Available), sum(Total) >= sum(Used) from information_schema.disks;
+sum(Total) >= sum(Available) sum(Total) >= sum(Used)
1 1
connection default;
DROP USER user1@localhost;
diff --git a/plugin/disks/mysql-test/disks/disks_notembedded.test b/plugin/disks/mysql-test/disks/disks_notembedded.test
index a0f6c2e5..4481da9f 100644
--- a/plugin/disks/mysql-test/disks/disks_notembedded.test
+++ b/plugin/disks/mysql-test/disks/disks_notembedded.test
@@ -10,7 +10,7 @@ GRANT SELECT ON *.* TO user1@localhost;
connect (con1,localhost,user1,,);
connection con1;
-select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
+select sum(Total) >= sum(Available), sum(Total) >= sum(Used) from information_schema.disks;
disconnect con1;
connection default;
@@ -18,7 +18,7 @@ GRANT FILE ON *.* TO user1@localhost;
connect (con1,localhost,user1,,);
connection con1;
-select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
+select sum(Total) >= sum(Available), sum(Total) >= sum(Used) from information_schema.disks;
connection default;
DROP USER user1@localhost;
diff --git a/plugin/feedback/CMakeLists.txt b/plugin/feedback/CMakeLists.txt
index 2103250e..fc35cbad 100644
--- a/plugin/feedback/CMakeLists.txt
+++ b/plugin/feedback/CMakeLists.txt
@@ -1,5 +1,5 @@
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql
- ${PCRE_INCLUDES}
+ ${PCRE_INCLUDE_DIRS}
${SSL_INCLUDE_DIRS})
SET(FEEDBACK_SOURCES feedback.cc sender_thread.cc
diff --git a/plugin/feedback/sender_thread.cc b/plugin/feedback/sender_thread.cc
index 6b5be475..cc29e57f 100644
--- a/plugin/feedback/sender_thread.cc
+++ b/plugin/feedback/sender_thread.cc
@@ -96,8 +96,8 @@ static int prepare_for_fill(TABLE_LIST *tables)
thd->mysys_var->current_cond= &sleep_condition;
thd->mysys_var->current_mutex= &sleep_mutex;
+ thd->mark_connection_idle();
thd->proc_info="feedback";
- thd->set_command(COM_SLEEP);
thd->system_thread= SYSTEM_THREAD_EVENT_WORKER; // whatever
thd->set_time();
thd->init_for_queries();
diff --git a/plugin/file_key_management/parser.cc b/plugin/file_key_management/parser.cc
index 57e0139a..a7b39f0a 100644
--- a/plugin/file_key_management/parser.cc
+++ b/plugin/file_key_management/parser.cc
@@ -260,7 +260,7 @@ int Parser::parse_line(char **line_ptr, keyentry *key)
while (isdigit(*p))
{
id = id * 10 + *p - '0';
- if (id > UINT_MAX32)
+ if (id > (longlong) UINT_MAX32)
{
report_error("Invalid key id", p - *line_ptr);
return -1;
diff --git a/plugin/hashicorp_key_management/hashicorp_key_management_plugin.cc b/plugin/hashicorp_key_management/hashicorp_key_management_plugin.cc
index 7c72af68..bdc2f734 100644
--- a/plugin/hashicorp_key_management/hashicorp_key_management_plugin.cc
+++ b/plugin/hashicorp_key_management/hashicorp_key_management_plugin.cc
@@ -593,32 +593,16 @@ int HCData::curl_run (const char *url, std::string *response,
{
const char *res = response->c_str();
/*
- Error 404 requires special handling - in case the server
- returned an empty array of error strings (the value of the
- "error" object in JSON is equal to an empty array), we should
- ignore this error at this level, since this means the missing
- key (this problem is handled at a higher level), but if the
- error object contains anything other than empty array, then
- we need to print the error message to the log:
+ Error 404 requires special handling - we should ignore this
+ error at this level, since this means the missing key (this
+ problem is handled at a higher level)
*/
if (http_code == 404)
{
- const char *err;
- int err_len;
- if (json_get_object_key(res, res + response->size(),
- "errors", &err, &err_len) == JSV_ARRAY)
- {
- const char *ev;
- int ev_len;
- if (json_get_array_item(err, err + err_len, 0, &ev, &ev_len) ==
- JSV_NOTHING)
- {
- *response = std::string("");
- is_error = false;
- }
- }
+ *response = std::string("");
+ is_error = false;
}
- if (is_error)
+ else if (is_error)
{
my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
"Hashicorp server error: %d, response: %s",
diff --git a/plugin/qc_info/CMakeLists.txt b/plugin/qc_info/CMakeLists.txt
index b8c5f926..329f49c1 100644
--- a/plugin/qc_info/CMakeLists.txt
+++ b/plugin/qc_info/CMakeLists.txt
@@ -1,4 +1,4 @@
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql
- ${PCRE_INCLUDES})
+ ${PCRE_INCLUDE_DIRS})
MYSQL_ADD_PLUGIN(QUERY_CACHE_INFO qc_info.cc RECOMPILE_FOR_EMBEDDED)
diff --git a/plugin/sql_errlog/sql_errlog.c b/plugin/sql_errlog/sql_errlog.c
index 0b7771f1..3631cd1d 100644
--- a/plugin/sql_errlog/sql_errlog.c
+++ b/plugin/sql_errlog/sql_errlog.c
@@ -15,6 +15,7 @@
#include <mysql/plugin_audit.h>
#include <stdio.h>
+#include <string.h>
#include <time.h>
#include <mysql/service_logger.h>
@@ -40,6 +41,7 @@ static unsigned long long size_limit;
static unsigned int rotations;
static char rotate;
static char warnings;
+static char with_db_and_thread_info;
static unsigned int count;
LOGGER_HANDLE *logfile;
@@ -73,6 +75,12 @@ static MYSQL_SYSVAR_BOOL(warnings, warnings,
"Warnings. If set to 0, warnings are not logged.",
NULL, NULL, 1);
+static MYSQL_SYSVAR_BOOL(with_db_and_thread_info, with_db_and_thread_info,
+ PLUGIN_VAR_READONLY | PLUGIN_VAR_OPCMDARG,
+ "Show details about thread id and database name in the log",
+ NULL, NULL,
+ 0);
+
static struct st_mysql_sys_var* vars[] = {
MYSQL_SYSVAR(rate),
MYSQL_SYSVAR(size_limit),
@@ -80,6 +88,7 @@ static struct st_mysql_sys_var* vars[] = {
MYSQL_SYSVAR(rotate),
MYSQL_SYSVAR(filename),
MYSQL_SYSVAR(warnings),
+ MYSQL_SYSVAR(with_db_and_thread_info),
NULL
};
@@ -90,6 +99,7 @@ static void log_sql_errors(MYSQL_THD thd __attribute__((unused)),
{
const struct mysql_event_general *event =
(const struct mysql_event_general*)ev;
+
if (rate &&
(event->event_subclass == MYSQL_AUDIT_GENERAL_ERROR ||
(warnings && event->event_subclass == MYSQL_AUDIT_GENERAL_WARNING)))
@@ -103,12 +113,35 @@ static void log_sql_errors(MYSQL_THD thd __attribute__((unused)),
count = 0;
(void) localtime_r(&event_time, &t);
- logger_printf(logfile, "%04d-%02d-%02d %2d:%02d:%02d "
+ if (with_db_and_thread_info)
+ {
+ if (event->database.str)
+ {
+ logger_printf(logfile, "%04d-%02d-%02d %2d:%02d:%02d %lu "
+ "%s %`s %s %d: %s : %s \n",
+ t.tm_year + 1900, t.tm_mon + 1, t.tm_mday, t.tm_hour, t.tm_min,
+ t.tm_sec, event->general_thread_id, event->general_user,
+ event->database.str, type,
+ event->general_error_code, event->general_command, event->general_query);
+ }
+ else
+ {
+ logger_printf(logfile, "%04d-%02d-%02d %2d:%02d:%02d %lu "
+ "%s NULL %s %d: %s : %s \n",
+ t.tm_year + 1900, t.tm_mon + 1, t.tm_mday, t.tm_hour, t.tm_min,
+ t.tm_sec, event->general_thread_id, event->general_user, type,
+ event->general_error_code, event->general_command, event->general_query);
+ }
+ }
+ else
+ {
+ logger_printf(logfile, "%04d-%02d-%02d %2d:%02d:%02d "
"%s %s %d: %s : %s\n",
- t.tm_year + 1900, t.tm_mon + 1,
- t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec,
- event->general_user, type, event->general_error_code,
- event->general_command, event->general_query);
+ t.tm_year + 1900, t.tm_mon + 1,
+ t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec,
+ event->general_user, type, event->general_error_code,
+ event->general_command, event->general_query);
+ }
}
}
}
@@ -167,7 +200,7 @@ maria_declare_plugin(sql_errlog)
0x0100,
NULL,
vars,
- "1.0",
+ "1.1",
MariaDB_PLUGIN_MATURITY_STABLE
}
maria_declare_plugin_end;
diff --git a/plugin/test_sql_service/CMakeLists.txt b/plugin/test_sql_service/CMakeLists.txt
index 615508bd..b40e2575 100644
--- a/plugin/test_sql_service/CMakeLists.txt
+++ b/plugin/test_sql_service/CMakeLists.txt
@@ -15,4 +15,4 @@
SET(SOURCES test_sql_service.c)
-MYSQL_ADD_PLUGIN(test_sql_service ${SOURCES} MODULE_ONLY)
+MYSQL_ADD_PLUGIN(test_sql_service ${SOURCES} MODULE_ONLY COMPONENT Test)
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet4_myisam.result b/plugin/type_inet/mysql-test/type_inet/type_inet4_myisam.result
index b6fd55e1..aaf66b34 100644
--- a/plugin/type_inet/mysql-test/type_inet/type_inet4_myisam.result
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet4_myisam.result
@@ -98,6 +98,8 @@ c
EXPLAIN SELECT * FROM t1 WHERE c>CAST('0.0.0.1' AS INET4);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index c c 67 NULL 3 Using where; Using index
+Warnings:
+Note 1105 Cannot use key `c` part[0] for lookup: `test`.`t1`.`c` of type `varchar` > "cast('0.0.0.1' as inet4)" of type `inet4`
SELECT * FROM t1 WHERE c=CAST('0.0.0.1' AS INET4);
c
0.0.0.1
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6.result b/plugin/type_inet/mysql-test/type_inet/type_inet6.result
index 1fe4decb..5ac2657f 100644
--- a/plugin/type_inet/mysql-test/type_inet/type_inet6.result
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.result
@@ -2284,6 +2284,81 @@ Warnings:
Warning 1292 Incorrect inet6 value: ''
DROP TABLE t1;
#
+# MDEV-32879 Server crash in my_decimal::operator= or unexpected ER_DUP_ENTRY upon comparison with INET6 and similar types
+#
+CREATE TABLE t1 (a CHAR(36) NOT NULL, b INET6 NOT NULL, c DATETIME(6) NOT NULL);
+INSERT INTO t1 VALUES ('','::','2000-01-01'),('','::','1900-01-01');
+SELECT c + (b = a) AS f, GROUP_CONCAT(c) FROM t1 GROUP BY f;
+f GROUP_CONCAT(c)
+NULL 2000-01-01 00:00:00.000000,1900-01-01 00:00:00.000000
+Warnings:
+Warning 1292 Incorrect inet6 value: ''
+Warning 1292 Incorrect inet6 value: ''
+Warning 1292 Incorrect inet6 value: ''
+Warning 1292 Incorrect inet6 value: ''
+Warning 1292 Incorrect inet6 value: ''
+DROP TABLE t1;
+CREATE TABLE t1 (a CHAR(36) NOT NULL, b INET6 NOT NULL, c DATETIME(6) NOT NULL);
+INSERT INTO t1 VALUES ('','::','2000-01-01'),('','::','1900-01-01');
+SELECT c + (b = a) AS f, COUNT(c) FROM t1 GROUP BY f;
+f COUNT(c)
+NULL 2
+Warnings:
+Warning 1292 Incorrect inet6 value: ''
+Warning 1292 Incorrect inet6 value: ''
+Warning 1292 Incorrect inet6 value: ''
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (a CHAR(36) NOT NULL, b INET6 NOT NULL, c DATETIME(6) NOT NULL);
+INSERT INTO t1 VALUES ('','::','2000-01-01'),('','::','1900-01-01');
+SELECT c + (b = a) AS f FROM t1 ORDER BY f;
+f
+NULL
+NULL
+Warnings:
+Warning 1292 Incorrect inet6 value: ''
+Warning 1292 Incorrect inet6 value: ''
+Warning 1292 Incorrect inet6 value: ''
+Warning 1292 Incorrect inet6 value: ''
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (a CHAR(36) NOT NULL, b INET6 NOT NULL);
+INSERT INTO t1 VALUES ('','::'),('','::');
+SELECT 1.00 + (b = a) AS f FROM t1 ORDER BY f;
+f
+NULL
+NULL
+Warnings:
+Warning 1292 Incorrect inet6 value: ''
+Warning 1292 Incorrect inet6 value: ''
+Warning 1292 Incorrect inet6 value: ''
+Warning 1292 Incorrect inet6 value: ''
+SELECT 1.00 + (b BETWEEN a AND '') AS f FROM t1 ORDER BY f;
+f
+NULL
+NULL
+Warnings:
+Warning 1292 Incorrect inet6 value: ''
+Warning 1292 Incorrect inet6 value: ''
+Warning 1292 Incorrect inet6 value: ''
+Warning 1292 Incorrect inet6 value: ''
+Warning 1292 Incorrect inet6 value: ''
+Warning 1292 Incorrect inet6 value: ''
+Warning 1292 Incorrect inet6 value: ''
+Warning 1292 Incorrect inet6 value: ''
+SELECT 1.00 + (b IN (a,'')) AS f FROM t1 ORDER BY f;
+f
+NULL
+NULL
+Warnings:
+Warning 1292 Incorrect inet6 value: ''
+Warning 1292 Incorrect inet6 value: ''
+Warning 1292 Incorrect inet6 value: ''
+Warning 1292 Incorrect inet6 value: ''
+Warning 1292 Incorrect inet6 value: ''
+Warning 1292 Incorrect inet6 value: ''
+Warning 1292 Incorrect inet6 value: ''
+Warning 1292 Incorrect inet6 value: ''
+DROP TABLE t1;
+#
# MDEV-22256 Assertion `length == pack_length()' failed in Field_timestamp_with_dec::sort_string
#
SET sql_mode='';
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6.test b/plugin/type_inet/mysql-test/type_inet/type_inet6.test
index 99f75312..0c56ecfe 100644
--- a/plugin/type_inet/mysql-test/type_inet/type_inet6.test
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.test
@@ -1676,6 +1676,32 @@ SELECT * FROM t1 WHERE a IN ('','::1');
DROP TABLE t1;
--echo #
+--echo # MDEV-32879 Server crash in my_decimal::operator= or unexpected ER_DUP_ENTRY upon comparison with INET6 and similar types
+--echo #
+
+CREATE TABLE t1 (a CHAR(36) NOT NULL, b INET6 NOT NULL, c DATETIME(6) NOT NULL);
+INSERT INTO t1 VALUES ('','::','2000-01-01'),('','::','1900-01-01');
+SELECT c + (b = a) AS f, GROUP_CONCAT(c) FROM t1 GROUP BY f;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a CHAR(36) NOT NULL, b INET6 NOT NULL, c DATETIME(6) NOT NULL);
+INSERT INTO t1 VALUES ('','::','2000-01-01'),('','::','1900-01-01');
+SELECT c + (b = a) AS f, COUNT(c) FROM t1 GROUP BY f;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (a CHAR(36) NOT NULL, b INET6 NOT NULL, c DATETIME(6) NOT NULL);
+INSERT INTO t1 VALUES ('','::','2000-01-01'),('','::','1900-01-01');
+SELECT c + (b = a) AS f FROM t1 ORDER BY f;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (a CHAR(36) NOT NULL, b INET6 NOT NULL);
+INSERT INTO t1 VALUES ('','::'),('','::');
+SELECT 1.00 + (b = a) AS f FROM t1 ORDER BY f;
+SELECT 1.00 + (b BETWEEN a AND '') AS f FROM t1 ORDER BY f;
+SELECT 1.00 + (b IN (a,'')) AS f FROM t1 ORDER BY f;
+DROP TABLE t1;
+
+--echo #
--echo # MDEV-22256 Assertion `length == pack_length()' failed in Field_timestamp_with_dec::sort_string
--echo #
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_myisam.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_myisam.result
index da67e05a..0f20e16d 100644
--- a/plugin/type_inet/mysql-test/type_inet/type_inet6_myisam.result
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_myisam.result
@@ -98,6 +98,8 @@ c
EXPLAIN SELECT * FROM t1 WHERE c>CAST('::1' AS INET6);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index c c 67 NULL 3 Using where; Using index
+Warnings:
+Note 1105 Cannot use key `c` part[0] for lookup: `test`.`t1`.`c` of type `varchar` > "cast('::1' as inet6)" of type `inet6`
SELECT * FROM t1 WHERE c=CAST('::1' AS INET6);
c
0::1
diff --git a/plugin/type_mysql_json/type.cc b/plugin/type_mysql_json/type.cc
index a39c4ad2..331e3bb2 100644
--- a/plugin/type_mysql_json/type.cc
+++ b/plugin/type_mysql_json/type.cc
@@ -37,6 +37,11 @@ public:
Field *make_table_field(MEM_ROOT *, const LEX_CSTRING *,
const Record_addr &, const Type_all_attributes &,
TABLE_SHARE *) const override;
+ bool Column_definition_fix_attributes(Column_definition *c) const override
+ {
+ my_error(ER_NOT_ALLOWED_IN_THIS_CONTEXT, MYF(0), "MYSQL_JSON");
+ return true;
+ }
void Column_definition_reuse_fix_attributes(THD *thd,
Column_definition *def,
const Field *field) const override;
@@ -74,7 +79,7 @@ public:
bool parse_mysql(String *dest, const char *data, size_t length) const;
bool send(Protocol *protocol) { return Field::send(protocol); }
void sql_type(String &s) const
- { s.set_ascii(STRING_WITH_LEN("json /* MySQL 5.7 */")); }
+ { s.set_ascii(STRING_WITH_LEN("mysql_json /* JSON from MySQL 5.7 */")); }
/* this will make ALTER TABLE to consider it different from built-in field */
Compression_method *compression_method() const { return (Compression_method*)1; }
};
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.result
index d769f1a1..37710ab1 100644
--- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.result
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.result
@@ -195,6 +195,8 @@ EXPLAIN SELECT * FROM t2 JOIN t1 ON ( t1.pk > t2.d);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
1 SIMPLE t2 ALL d NULL NULL NULL 1 Using where
+Warnings:
+Note 1105 Cannot use key `d` part[0] for lookup: `test`.`t2`.`d` of type `blob` < "'00000000-0000-0000-0000-000000000000'" of type `uuid`
UPDATE t2 JOIN t1 ON ( t1.pk > t2.d) SET t1.c = 1;
ERROR 22007: Incorrect uuid value: '2'
DROP TABLE t1, t2;
diff --git a/plugin/user_variables/user_variables.cc b/plugin/user_variables/user_variables.cc
index df2ab4af..79c96704 100644
--- a/plugin/user_variables/user_variables.cc
+++ b/plugin/user_variables/user_variables.cc
@@ -79,9 +79,9 @@ static int user_variables_fill(THD *thd, TABLE_LIST *tables, COND *cond)
else
return 1;
- const LEX_CSTRING *tmp= var->unsigned_flag ?
- &unsigned_result_types[var->type] :
- &result_types[var->type];
+ const LEX_CSTRING *tmp= var->type_handler()->is_unsigned() ?
+ &unsigned_result_types[var->type_handler()->result_type()] :
+ &result_types[var->type_handler()->result_type()];
field[2]->store(tmp->str, tmp->length, system_charset_info);
if (var->charset())