summaryrefslogtreecommitdiffstats
path: root/plugin
diff options
context:
space:
mode:
Diffstat (limited to 'plugin')
-rw-r--r--plugin/auth_ed25519/client_ed25519.c2
-rw-r--r--plugin/auth_examples/qa_auth_client.c3
-rw-r--r--plugin/auth_examples/qa_auth_interface.c3
-rw-r--r--plugin/auth_examples/test_plugin.c3
-rw-r--r--plugin/aws_key_management/aws_key_management_plugin.cc35
-rw-r--r--plugin/feedback/url_http.cc7
-rw-r--r--plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_rotation_age.test8
-rw-r--r--plugin/metadata_lock_info/metadata_lock_info.cc2
-rw-r--r--plugin/type_geom/plugin.cc11
-rw-r--r--plugin/type_inet/item_inetfunc.cc3
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet4.result14
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6.result14
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_mix_inet4.result72
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_mix_inet4.test37
-rw-r--r--plugin/type_inet/sql_type_inet.cc38
-rw-r--r--plugin/type_inet/sql_type_inet.h39
-rw-r--r--plugin/type_uuid/mysql-test/type_uuid/type_uuid.result14
-rw-r--r--plugin/type_uuid/plugin.cc5
-rw-r--r--plugin/type_uuid/sql_type_uuid.h8
-rw-r--r--plugin/wsrep_info/mysql-test/wsrep_info/my.cnf2
20 files changed, 247 insertions, 73 deletions
diff --git a/plugin/auth_ed25519/client_ed25519.c b/plugin/auth_ed25519/client_ed25519.c
index 5222da8c..cc2dda92 100644
--- a/plugin/auth_ed25519/client_ed25519.c
+++ b/plugin/auth_ed25519/client_ed25519.c
@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
-
+#error see libmariadb/plugins/auth/ed25519.c instead
/************************** CLIENT *************************************/
#include <stdlib.h>
diff --git a/plugin/auth_examples/qa_auth_client.c b/plugin/auth_examples/qa_auth_client.c
index a915306e..af05c9b1 100644
--- a/plugin/auth_examples/qa_auth_client.c
+++ b/plugin/auth_examples/qa_auth_client.c
@@ -113,5 +113,6 @@ mysql_declare_client_plugin(AUTHENTICATION)
NULL,
NULL,
NULL,
- test_plugin_client
+ test_plugin_client,
+ NULL
mysql_end_client_plugin;
diff --git a/plugin/auth_examples/qa_auth_interface.c b/plugin/auth_examples/qa_auth_interface.c
index ad1f6fff..3903f3d2 100644
--- a/plugin/auth_examples/qa_auth_interface.c
+++ b/plugin/auth_examples/qa_auth_interface.c
@@ -250,5 +250,6 @@ mysql_declare_client_plugin(AUTHENTICATION)
NULL,
NULL,
NULL,
- test_plugin_client
+ test_plugin_client,
+ NULL
mysql_end_client_plugin;
diff --git a/plugin/auth_examples/test_plugin.c b/plugin/auth_examples/test_plugin.c
index 04405a1c..f5ef08dd 100644
--- a/plugin/auth_examples/test_plugin.c
+++ b/plugin/auth_examples/test_plugin.c
@@ -230,5 +230,6 @@ mysql_declare_client_plugin(AUTHENTICATION)
NULL,
NULL,
NULL,
- test_plugin_client
+ test_plugin_client,
+ NULL
mysql_end_client_plugin;
diff --git a/plugin/aws_key_management/aws_key_management_plugin.cc b/plugin/aws_key_management/aws_key_management_plugin.cc
index 7740c2ea..496c7704 100644
--- a/plugin/aws_key_management/aws_key_management_plugin.cc
+++ b/plugin/aws_key_management/aws_key_management_plugin.cc
@@ -82,6 +82,7 @@ static unsigned long log_level;
static int rotate_key;
static int request_timeout;
static char* endpoint_url;
+static char* keyfile_dir;
#ifndef DBUG_OFF
#define WITH_AWS_MOCK 1
@@ -187,13 +188,23 @@ protected:
}
};
-/* Get list of files in current directory */
-static vector<string> traverse_current_directory()
+/* Get keyfile directory */
+static const char * get_keyfile_dir()
+{
+ if (keyfile_dir && keyfile_dir[0])
+ return keyfile_dir;
+ return ".";
+}
+
+/* Get list of files in keyfile directory */
+static vector<string> traverse_keyfile_directory()
{
vector<string> v;
#ifdef _WIN32
WIN32_FIND_DATA find_data;
- HANDLE h= FindFirstFile("*.*", &find_data);
+ char path[FN_REFLEN];
+ snprintf(path, sizeof(path), "%s\\*.*", get_keyfile_dir());
+ HANDLE h= FindFirstFile(path, &find_data);
if (h == INVALID_HANDLE_VALUE)
return v;
do
@@ -203,7 +214,7 @@ static vector<string> traverse_current_directory()
while (FindNextFile(h, &find_data));
FindClose(h);
#else
- DIR *dir = opendir(".");
+ DIR *dir = opendir(get_keyfile_dir());
if (!dir)
return v;
struct dirent *e;
@@ -272,7 +283,7 @@ static int plugin_init(void *p)
if (init())
return -1;
- vector<string> files= traverse_current_directory();
+ vector<string> files= traverse_keyfile_directory();
for (size_t i=0; i < files.size(); i++)
{
@@ -316,7 +327,7 @@ static int plugin_deinit(void *p)
/* Generate filename to store the ciphered key */
static void format_keyfile_name(char *buf, size_t size, uint key_id, uint version)
{
- snprintf(buf, size, "aws-kms-key.%u.%u", key_id, version);
+ snprintf(buf, size, "%s%saws-kms-key.%u.%u", get_keyfile_dir(), IF_WIN("\\","/"), key_id, version);
}
/* Extract key id and version from file name */
@@ -336,7 +347,7 @@ static int extract_id_and_version(const char *name, uint *id, uint *ver)
static int load_key(KEY_INFO *info)
{
int ret;
- char path[256];
+ char path[FN_REFLEN];
format_keyfile_name(path, sizeof(path), info->key_id, info->key_version);
ret= read_and_decrypt_key(path, info);
@@ -531,7 +542,7 @@ static int generate_and_save_datakey(uint keyid, uint version)
return -1;
string out;
- char filename[20];
+ char filename[FN_REFLEN];
format_keyfile_name(filename, sizeof(filename), keyid, version);
int fd= open(filename, O_WRONLY |O_CREAT|O_BINARY, IF_WIN(_S_IREAD, S_IRUSR| S_IRGRP| S_IROTH));
if (fd < 0)
@@ -652,7 +663,6 @@ static unsigned int get_key(
return(0);
}
-
/* Plugin defs */
struct st_mariadb_encryption aws_key_management_plugin= {
MariaDB_ENCRYPTION_INTERFACE_VERSION,
@@ -725,6 +735,12 @@ static MYSQL_SYSVAR_STR(endpoint_url, endpoint_url,
"Used to override the default AWS API endpoint. If not set, the default will be used",
NULL, NULL, "");
+static MYSQL_SYSVAR_STR(keyfile_dir, keyfile_dir,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "Define the directory in which to save key files for the AWS key"
+ "management plugin. If not set, the root datadir will be used",
+ NULL, NULL, "");
+
#if WITH_AWS_MOCK
static MYSQL_SYSVAR_BOOL(mock, mock,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
@@ -740,6 +756,7 @@ static struct st_mysql_sys_var* settings[]= {
MYSQL_SYSVAR(request_timeout),
MYSQL_SYSVAR(region),
MYSQL_SYSVAR(endpoint_url),
+ MYSQL_SYSVAR(keyfile_dir),
#if WITH_AWS_MOCK
MYSQL_SYSVAR(mock),
#endif
diff --git a/plugin/feedback/url_http.cc b/plugin/feedback/url_http.cc
index 590bb06c..aa1706bb 100644
--- a/plugin/feedback/url_http.cc
+++ b/plugin/feedback/url_http.cc
@@ -176,7 +176,12 @@ int Url_http::send(const char* data, size_t data_length)
char buf[1024];
size_t len= 0;
- addrinfo *addrs, *addr, filter= {0, AF_UNSPEC, SOCK_STREAM, 6, 0, 0, 0, 0};
+ addrinfo *addrs, *addr, filter;
+ bzero((void*) &filter, sizeof(filter));
+ filter.ai_family= AF_UNSPEC;
+ filter.ai_socktype= SOCK_STREAM;
+ filter.ai_protocol=6;
+
int res= use_proxy() ?
getaddrinfo(proxy_host.str, proxy_port.str, &filter, &addrs) :
getaddrinfo(host.str, port.str, &filter, &addrs);
diff --git a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_rotation_age.test b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_rotation_age.test
index 4cdeb227..4eb7cdcf 100644
--- a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_rotation_age.test
+++ b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_rotation_age.test
@@ -33,7 +33,7 @@ let $restart_parameters=$default_parameters --innodb_encryption_threads=5 --inno
--echo # Wait until encryption threads have encrypted all tablespaces
---let $tables_count= `select count(*) + 1 from information_schema.tables where engine = 'InnoDB'`
+--let $tables_count= `select count(*) + 1 + @@global.innodb_undo_tablespaces from information_schema.tables where engine = 'InnoDB'`
--let $wait_timeout= 600
--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
--source include/wait_condition.inc
@@ -63,7 +63,7 @@ alter table t33 encryption_key_id=222;
--echo # Wait until encryption threads have encrypted all tablespaces
---let $tables_count= `select count(*) from information_schema.tables where engine = 'InnoDB'`
+--let $tables_count= `select count(*) + @@global.innodb_undo_tablespaces from information_schema.tables where engine = 'InnoDB'`
--let $wait_timeout= 600
--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
--source include/wait_condition.inc
@@ -77,7 +77,7 @@ set global innodb_encrypt_tables = OFF;
--echo # Wait until encryption threads to decrypt all encrypted tablespaces
---let $tables_count= `select count(*) - 1 from information_schema.tables where engine = 'InnoDB'`
+--let $tables_count= `select count(*) - 1 + @@global.innodb_undo_tablespaces from information_schema.tables where engine = 'InnoDB'`
--let $wait_timeout= 600
--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND ROTATING_OR_FLUSHING = 0;
--source include/wait_condition.inc
@@ -105,7 +105,7 @@ set global innodb_encrypt_tables = ON;
--echo # Wait until encryption threads to encrypt all unencrypted tablespaces
---let $tables_count= `select count(*) from information_schema.tables where engine = 'InnoDB'`
+--let $tables_count= `select count(*) + @@global.innodb_undo_tablespaces from information_schema.tables where engine = 'InnoDB'`
--let $wait_timeout= 600
--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
--source include/wait_condition.inc
diff --git a/plugin/metadata_lock_info/metadata_lock_info.cc b/plugin/metadata_lock_info/metadata_lock_info.cc
index a85048de..35b9b507 100644
--- a/plugin/metadata_lock_info/metadata_lock_info.cc
+++ b/plugin/metadata_lock_info/metadata_lock_info.cc
@@ -70,7 +70,7 @@ int i_s_metadata_lock_info_fill_row(
DBUG_RETURN(0);
table->field[0]->store((longlong) mdl_ctx->get_thread_id(), TRUE);
table->field[1]->set_notnull();
- table->field[1]->store(mdl_ticket->get_type_name(), system_charset_info);
+ table->field[1]->store(*mdl_ticket->get_type_name(), system_charset_info);
table->field[2]->set_null();
table->field[3]->set_notnull();
table->field[3]->store(
diff --git a/plugin/type_geom/plugin.cc b/plugin/type_geom/plugin.cc
index b462a34c..1b740ebb 100644
--- a/plugin/type_geom/plugin.cc
+++ b/plugin/type_geom/plugin.cc
@@ -158,17 +158,6 @@ static int get_geometry_column_record(THD *thd, TABLE_LIST *tables,
Field **ptr, *field;
DBUG_ENTER("get_geometry_column_record");
- if (res)
- {
- /*
- open_table() failed with an error.
- Convert the error to a warning and let the caller
- continue with the next table.
- */
- convert_error_to_warning(thd);
- DBUG_RETURN(0);
- }
-
// Skip INFORMATION_SCHEMA tables. They don't have geometry columns.
if (tables->schema_table)
DBUG_RETURN(0);
diff --git a/plugin/type_inet/item_inetfunc.cc b/plugin/type_inet/item_inetfunc.cc
index 1551b53b..bbccffad 100644
--- a/plugin/type_inet/item_inetfunc.cc
+++ b/plugin/type_inet/item_inetfunc.cc
@@ -246,7 +246,8 @@ longlong Item_func_is_ipv6::val_int()
{
DBUG_ASSERT(fixed());
String_ptr_and_buffer<STRING_BUFFER_USUAL_SIZE> tmp(args[0]);
- return !tmp.is_null() && !Type_handler_inet6::Fbt_null(*tmp.string()).is_null();
+ return !tmp.is_null() && tmp.string()->strstr(STRING_WITH_LEN(":")) >= 0 &&
+ !Type_handler_inet6::Fbt_null(*tmp.string()).is_null();
}
/**
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet4.result b/plugin/type_inet/mysql-test/type_inet/type_inet4.result
index 7763b28e..a8786e07 100644
--- a/plugin/type_inet/mysql-test/type_inet/type_inet4.result
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet4.result
@@ -41,6 +41,8 @@ PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
+IS_SYSTEM_TIME_PERIOD_START NO
+IS_SYSTEM_TIME_PERIOD_END NO
DROP TABLE t1;
CREATE TABLE t1 (a INET4);
INSERT INTO t1 VALUES ('0.0.0.1');
@@ -101,6 +103,8 @@ PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
+IS_SYSTEM_TIME_PERIOD_START NO
+IS_SYSTEM_TIME_PERIOD_END NO
TABLE_CATALOG def
TABLE_SCHEMA test
TABLE_NAME t1
@@ -123,6 +127,8 @@ PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
+IS_SYSTEM_TIME_PERIOD_START NO
+IS_SYSTEM_TIME_PERIOD_END NO
TABLE_CATALOG def
TABLE_SCHEMA test
TABLE_NAME t1
@@ -145,6 +151,8 @@ PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
+IS_SYSTEM_TIME_PERIOD_START NO
+IS_SYSTEM_TIME_PERIOD_END NO
TABLE_CATALOG def
TABLE_SCHEMA test
TABLE_NAME t1
@@ -167,6 +175,8 @@ PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
+IS_SYSTEM_TIME_PERIOD_START NO
+IS_SYSTEM_TIME_PERIOD_END NO
TABLE_CATALOG def
TABLE_SCHEMA test
TABLE_NAME t1
@@ -189,6 +199,8 @@ PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
+IS_SYSTEM_TIME_PERIOD_START NO
+IS_SYSTEM_TIME_PERIOD_END NO
DROP TABLE t1;
CREATE TABLE t1 (c1 INET4 DEFAULT 0x00);
ERROR 42000: Invalid default value for 'c1'
@@ -1337,7 +1349,7 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT * FROM t1 WHERE b IN (SELECT a AS a_inner FROM t1 GROUP BY a_inner);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 2 Using index; Using where
+2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1 Using index; Using where
SET @@optimizer_switch=DEFAULT;
DROP TABLE t1;
#
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 d43352df..4620f405 100644
--- a/plugin/type_inet/mysql-test/type_inet/type_inet6.result
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.result
@@ -35,6 +35,8 @@ PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
+IS_SYSTEM_TIME_PERIOD_START NO
+IS_SYSTEM_TIME_PERIOD_END NO
DROP TABLE t1;
CREATE TABLE t1 (a INET6);
INSERT INTO t1 VALUES ('::1');
@@ -95,6 +97,8 @@ PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
+IS_SYSTEM_TIME_PERIOD_START NO
+IS_SYSTEM_TIME_PERIOD_END NO
TABLE_CATALOG def
TABLE_SCHEMA test
TABLE_NAME t1
@@ -117,6 +121,8 @@ PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
+IS_SYSTEM_TIME_PERIOD_START NO
+IS_SYSTEM_TIME_PERIOD_END NO
TABLE_CATALOG def
TABLE_SCHEMA test
TABLE_NAME t1
@@ -139,6 +145,8 @@ PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
+IS_SYSTEM_TIME_PERIOD_START NO
+IS_SYSTEM_TIME_PERIOD_END NO
TABLE_CATALOG def
TABLE_SCHEMA test
TABLE_NAME t1
@@ -161,6 +169,8 @@ PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
+IS_SYSTEM_TIME_PERIOD_START NO
+IS_SYSTEM_TIME_PERIOD_END NO
TABLE_CATALOG def
TABLE_SCHEMA test
TABLE_NAME t1
@@ -183,6 +193,8 @@ PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
+IS_SYSTEM_TIME_PERIOD_START NO
+IS_SYSTEM_TIME_PERIOD_END NO
DROP TABLE t1;
CREATE TABLE t1 (c1 INET6 DEFAULT 0x00);
ERROR 42000: Invalid default value for 'c1'
@@ -1330,7 +1342,7 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT * FROM t1 WHERE b IN (SELECT a AS a_inner FROM t1 GROUP BY a_inner);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t1 index_subquery a a 17 func 2 Using index; Using where
+2 DEPENDENT SUBQUERY t1 index_subquery a a 17 func 1 Using index; Using where
SET @@optimizer_switch=DEFAULT;
DROP TABLE t1;
#
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_inet4.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_inet4.result
index 0910f2d8..9d2e1c31 100644
--- a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_inet4.result
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_inet4.result
@@ -1,19 +1,63 @@
#
-# Start of 10.10 tests
-#
-#
# MDEV-23287 The INET4 data type
#
-CREATE TABLE t1 (i4 INET4, i6 INET6);
-SELECT * FROM t1 WHERE i4=i6;
-ERROR HY000: Illegal parameter data types inet4 and inet6 for operation '='
-SELECT COALESCE(i4,i6) FROM t1 WHERE i4=i6;
-ERROR HY000: Illegal parameter data types inet4 and inet6 for operation 'coalesce'
-SELECT LEAST(i4,i6) FROM t1 WHERE i4=i6;
-ERROR HY000: Illegal parameter data types inet4 and inet6 for operation 'least'
-SELECT i4 FROM t1 UNION ALL SELECT i6 FROM t1;
-ERROR HY000: Illegal parameter data types inet4 and inet6 for operation 'UNION'
-DROP TABLE t1;
+create table t1 (i4 inet4 not null);
+create table t2 (i6 inet6 not null);
+insert t1 values ('127.0.0.1'), ('192.168.1.2'), ('1.2.3.4'), ('8.8.8.8');
+insert t2 values ('2001:db8::ff00:42:8329'), ('fe80::42:70ff:fe94:6b97');
+select * from t1;
+i4
+127.0.0.1
+192.168.1.2
+1.2.3.4
+8.8.8.8
+select * from t2;
+i6
+2001:db8::ff00:42:8329
+fe80::42:70ff:fe94:6b97
+select * from t1 union select * from t2;
+i4
+::ffff:127.0.0.1
+::ffff:192.168.1.2
+::ffff:1.2.3.4
+::ffff:8.8.8.8
+2001:db8::ff00:42:8329
+fe80::42:70ff:fe94:6b97
+insert t2 select * from t1;
+select * from t2;
+i6
+2001:db8::ff00:42:8329
+fe80::42:70ff:fe94:6b97
+::ffff:127.0.0.1
+::ffff:192.168.1.2
+::ffff:1.2.3.4
+::ffff:8.8.8.8
+select * from t1, t2 where t1.i4=t2.i6;
+i4 i6
+127.0.0.1 ::ffff:127.0.0.1
+192.168.1.2 ::ffff:192.168.1.2
+1.2.3.4 ::ffff:1.2.3.4
+8.8.8.8 ::ffff:8.8.8.8
+select coalesce(i4,i6) from t1, t2 where i4=i6;
+coalesce(i4,i6)
+::ffff:127.0.0.1
+::ffff:192.168.1.2
+::ffff:1.2.3.4
+::ffff:8.8.8.8
+select least(i4,i6) from t1, t2 where i4=i6;
+least(i4,i6)
+::ffff:127.0.0.1
+::ffff:192.168.1.2
+::ffff:1.2.3.4
+::ffff:8.8.8.8
+alter table t1 modify i4 inet6;
+select * from t1;
+i4
+::ffff:127.0.0.1
+::ffff:192.168.1.2
+::ffff:1.2.3.4
+::ffff:8.8.8.8
+drop table t1, t2;
#
-# End of 10.10 tests
+# End of 11.2 tests
#
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_inet4.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_inet4.test
index ac35b95b..aea9eac0 100644
--- a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_inet4.test
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_inet4.test
@@ -1,26 +1,31 @@
--echo #
---echo # Start of 10.10 tests
---echo #
-
---echo #
--echo # MDEV-23287 The INET4 data type
--echo #
-# Mixing INET6 and INET4 is not implemented yet
+create table t1 (i4 inet4 not null);
+create table t2 (i6 inet6 not null);
+
+insert t1 values ('127.0.0.1'), ('192.168.1.2'), ('1.2.3.4'), ('8.8.8.8');
+insert t2 values ('2001:db8::ff00:42:8329'), ('fe80::42:70ff:fe94:6b97');
+
+select * from t1;
+select * from t2;
+
+select * from t1 union select * from t2;
+
+insert t2 select * from t1;
+select * from t2;
+
+select * from t1, t2 where t1.i4=t2.i6;
-CREATE TABLE t1 (i4 INET4, i6 INET6);
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT * FROM t1 WHERE i4=i6;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT COALESCE(i4,i6) FROM t1 WHERE i4=i6;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT LEAST(i4,i6) FROM t1 WHERE i4=i6;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT i4 FROM t1 UNION ALL SELECT i6 FROM t1;
+select coalesce(i4,i6) from t1, t2 where i4=i6;
+select least(i4,i6) from t1, t2 where i4=i6;
-DROP TABLE t1;
+alter table t1 modify i4 inet6;
+select * from t1;
+drop table t1, t2;
--echo #
---echo # End of 10.10 tests
+--echo # End of 11.2 tests
--echo #
diff --git a/plugin/type_inet/sql_type_inet.cc b/plugin/type_inet/sql_type_inet.cc
index d23073d2..5907a3a9 100644
--- a/plugin/type_inet/sql_type_inet.cc
+++ b/plugin/type_inet/sql_type_inet.cc
@@ -269,6 +269,12 @@ bool Inet6::ascii_to_fbt(const char *str, size_t str_length)
return true;
}
+ if (group_start_ptr == str)
+ {
+ dst[10]= dst[11]= (unsigned char) 0xff;
+ dst+= 12;
+ }
+
tmp.to_record(dst, IN_ADDR_SIZE);
dst += IN_ADDR_SIZE;
chars_in_group= 0;
@@ -519,3 +525,35 @@ const Name &Inet4::default_value()
static Name def(STRING_WITH_LEN("0.0.0.0"));
return def;
}
+
+static const Type_handler *inet4()
+{ return Type_handler_inet4::singleton(); }
+
+static const Type_handler *inet6()
+{ return Type_handler_inet6::singleton(); }
+
+const Type_handler *Type_collection_inet::find_in_array(const Type_handler *a,
+ const Type_handler *b,
+ int start) const
+{
+ if (a == b) return a;
+ if (a != inet6() && b->type_collection() == this) // inet6 or inet4
+ std::swap(a, b);
+
+ /*
+ Search in the array for an element, equal to `b`.
+ If found - return `a`, if not found - return NULL.
+ Array is terminated by `a`.
+ Start the search from `start`
+ */
+ static const Type_handler *arr[]={ &type_handler_varchar,
+ &type_handler_string, &type_handler_tiny_blob, &type_handler_blob,
+ &type_handler_medium_blob, &type_handler_hex_hybrid,
+ // in aggregate_for_comparison() all types above cannot happen
+ &type_handler_null, &type_handler_long_blob, inet4(), inet6() };
+
+ for (int i= start; arr[i] != a; i++)
+ if (arr[i] == b)
+ return a;
+ return NULL;
+}
diff --git a/plugin/type_inet/sql_type_inet.h b/plugin/type_inet/sql_type_inet.h
index bb14dab1..d77da4a7 100644
--- a/plugin/type_inet/sql_type_inet.h
+++ b/plugin/type_inet/sql_type_inet.h
@@ -42,9 +42,44 @@ public:
static const Name &default_value();
};
+class Type_collection_inet: public Type_collection
+{
+ const Type_handler *find_in_array(const Type_handler *what,
+ const Type_handler *stop, int start) const;
+public:
+ const Type_handler *aggregate_for_result(const Type_handler *a,
+ const Type_handler *b)
+ const override
+ { return find_in_array(a, b, 0); }
+ const Type_handler *aggregate_for_min_max(const Type_handler *a,
+ const Type_handler *b)
+ const override
+ { return find_in_array(a, b, 0); }
+ const Type_handler *aggregate_for_comparison(const Type_handler *a,
+ const Type_handler *b)
+ const override
+ { return find_in_array(a, b, 6); } // skip types that cannot happen here
+ const Type_handler *aggregate_for_num_op(const Type_handler *a,
+ const Type_handler *b)
+ const override
+ { return NULL; }
+
+ static Type_collection_inet *singleton()
+ {
+ static Type_collection_inet tc;
+ return &tc;
+ }
+
+ const Type_handler *type_handler_for_implicit_upgrade(
+ const Type_handler *from) const
+ {
+ return from;
+ }
+};
#include "sql_type_fixedbin.h"
-typedef Type_handler_fbt<Inet6> Type_handler_inet6;
+
+typedef Type_handler_fbt<Inet6, Type_collection_inet> Type_handler_inet6;
/***********************************************************************/
@@ -57,7 +92,7 @@ public:
static const Name &default_value();
};
-typedef Type_handler_fbt<Inet4> Type_handler_inet4;
+typedef Type_handler_fbt<Inet4, Type_collection_inet> Type_handler_inet4;
#endif /* SQL_TYPE_INET_H */
diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result
index de17d6fb..d8603f56 100644
--- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result
+++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result
@@ -38,6 +38,8 @@ PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
+IS_SYSTEM_TIME_PERIOD_START NO
+IS_SYSTEM_TIME_PERIOD_END NO
DROP TABLE t1;
CREATE TABLE t1 (a UUID);
INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001');
@@ -98,6 +100,8 @@ PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
+IS_SYSTEM_TIME_PERIOD_START NO
+IS_SYSTEM_TIME_PERIOD_END NO
TABLE_CATALOG def
TABLE_SCHEMA test
TABLE_NAME t1
@@ -120,6 +124,8 @@ PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
+IS_SYSTEM_TIME_PERIOD_START NO
+IS_SYSTEM_TIME_PERIOD_END NO
TABLE_CATALOG def
TABLE_SCHEMA test
TABLE_NAME t1
@@ -142,6 +148,8 @@ PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
+IS_SYSTEM_TIME_PERIOD_START NO
+IS_SYSTEM_TIME_PERIOD_END NO
TABLE_CATALOG def
TABLE_SCHEMA test
TABLE_NAME t1
@@ -164,6 +172,8 @@ PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
+IS_SYSTEM_TIME_PERIOD_START NO
+IS_SYSTEM_TIME_PERIOD_END NO
TABLE_CATALOG def
TABLE_SCHEMA test
TABLE_NAME t1
@@ -186,6 +196,8 @@ PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
+IS_SYSTEM_TIME_PERIOD_START NO
+IS_SYSTEM_TIME_PERIOD_END NO
DROP TABLE t1;
CREATE TABLE t1 (c1 UUID DEFAULT 0x00);
ERROR 42000: Invalid default value for 'c1'
@@ -2524,7 +2536,7 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT * FROM t1 WHERE b IN (SELECT a AS a_inner FROM t1 GROUP BY a_inner);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t1 index_subquery a a 17 func 2 Using index; Using where
+2 DEPENDENT SUBQUERY t1 index_subquery a a 17 func 1 Using index; Using where
SET @@optimizer_switch=DEFAULT;
DROP TABLE t1;
#
diff --git a/plugin/type_uuid/plugin.cc b/plugin/type_uuid/plugin.cc
index a1bde541..d19e9b8f 100644
--- a/plugin/type_uuid/plugin.cc
+++ b/plugin/type_uuid/plugin.cc
@@ -63,7 +63,7 @@ static struct st_mariadb_data_type plugin_descriptor_type_uuid=
const Type_handler *Type_collection_uuid::find_in_array(const Type_handler *a,
const Type_handler *b,
- bool for_cmp) const
+ int start) const
{
if (a == b) return a;
@@ -83,6 +83,7 @@ const Type_handler *Type_collection_uuid::find_in_array(const Type_handler *a,
Search in the array for an element, equal to `b`.
If found - return `a`, if not found - return NULL.
Array is terminated by `a`.
+ Start the search from `start`
*/
static const Type_handler *arr[]={ &type_handler_varchar,
&type_handler_string, &type_handler_tiny_blob, &type_handler_blob,
@@ -92,7 +93,7 @@ const Type_handler *Type_collection_uuid::find_in_array(const Type_handler *a,
&type_handler_null, &type_handler_long_blob,
Type_handler_uuid_old::singleton(), Type_handler_uuid_new::singleton() };
- for (int i= for_cmp ? 6 : 0; arr[i] != a; i++)
+ for (int i= start; arr[i] != a; i++)
if (arr[i] == b)
return a;
return NULL;
diff --git a/plugin/type_uuid/sql_type_uuid.h b/plugin/type_uuid/sql_type_uuid.h
index 05d6cef6..9fca6878 100644
--- a/plugin/type_uuid/sql_type_uuid.h
+++ b/plugin/type_uuid/sql_type_uuid.h
@@ -297,20 +297,20 @@ class Type_collection_uuid: public Type_collection
{
const Type_handler *find_in_array(const Type_handler *what,
const Type_handler *stop,
- bool for_comparison) const;
+ int start) const;
public:
const Type_handler *aggregate_for_result(const Type_handler *a,
const Type_handler *b)
const override
- { return find_in_array(a, b, false); }
+ { return find_in_array(a, b, 0); }
const Type_handler *aggregate_for_min_max(const Type_handler *a,
const Type_handler *b)
const override
- { return find_in_array(a, b, false); }
+ { return find_in_array(a, b, 0); }
const Type_handler *aggregate_for_comparison(const Type_handler *a,
const Type_handler *b)
const override
- { return find_in_array(a, b, true); }
+ { return find_in_array(a, b, 6); } // skip types that cannot happen here
const Type_handler *aggregate_for_num_op(const Type_handler *a,
const Type_handler *b)
const override
diff --git a/plugin/wsrep_info/mysql-test/wsrep_info/my.cnf b/plugin/wsrep_info/mysql-test/wsrep_info/my.cnf
index 8f62cfd0..5adf6313 100644
--- a/plugin/wsrep_info/mysql-test/wsrep_info/my.cnf
+++ b/plugin/wsrep_info/mysql-test/wsrep_info/my.cnf
@@ -1,5 +1,5 @@
# Use default setting for mysqld processes
-!include include/default_mysqld.cnf
+!include include/default_my.cnf
[mysqld]
binlog-format=row