diff options
author | Alexander Barkov <bar@mariadb.com> | 2022-06-03 19:58:17 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2022-06-03 23:14:25 +0400 |
commit | 6d99fdce184c2a5d1a0eb0b0cb3360df7cbfb7f8 (patch) | |
tree | 377f6335e1c8e9bbf138a68f0b96398684a4d791 | |
parent | 22f935d6daa70a21a3f640261fcf8c9dfb259250 (diff) | |
download | mariadb-git-bb-10.5-bar.tar.gz |
MDEV-28491 Uuid. "UPDATE/DELETE" not working "WHERE id IN (SELECT id FROM ..)"bb-10.5-bar
This is a 10.5 version of the patch.
-rw-r--r-- | plugin/type_inet/mysql-test/type_inet/type_inet6.result | 19 | ||||
-rw-r--r-- | plugin/type_inet/mysql-test/type_inet/type_inet6.test | 18 | ||||
-rw-r--r-- | plugin/type_inet/sql_type_inet.cc | 11 |
3 files changed, 45 insertions, 3 deletions
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 ac16f5c06ce..2cc6942aa52 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6.result +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.result @@ -2194,3 +2194,22 @@ SELECT IF(1, '::', a) AS f FROM t1 GROUP BY 'foo' HAVING f != '::1'; f :: DROP TABLE t1; +# +# MDEV-28491 Uuid. "UPDATE/DELETE" not working "WHERE id IN (SELECT id FROM ..)" +# +CREATE TABLE companies (id INET6, name varchar(10)); +INSERT INTO companies (id) values ('00::01'); +CREATE TABLE divisions (company_id INET6); +INSERT INTO divisions (company_id) values ('00::01'); +SELECT * FROM companies WHERE id IN (SELECT company_id FROM divisions); +id name +::1 NULL +UPDATE companies SET name = 'value' WHERE id IN (SELECT company_id FROM divisions); +SELECT * FROM companies; +id name +::1 value +DELETE FROM companies WHERE id IN (SELECT company_id FROM divisions); +SELECT * FROM companies; +id name +DROP TABLE divisions; +DROP TABLE companies; 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 6a5db1ad43f..ef8399d981f 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6.test +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.test @@ -1612,3 +1612,21 @@ SELECT IF(1, '::', a) AS f FROM t1 GROUP BY 'foo' HAVING f != ''; SELECT IF(1, '::', a) AS f FROM t1 GROUP BY 'foo' HAVING f != '::'; SELECT IF(1, '::', a) AS f FROM t1 GROUP BY 'foo' HAVING f != '::1'; DROP TABLE t1; + + +--echo # +--echo # MDEV-28491 Uuid. "UPDATE/DELETE" not working "WHERE id IN (SELECT id FROM ..)" +--echo # + +CREATE TABLE companies (id INET6, name varchar(10)); +INSERT INTO companies (id) values ('00::01'); + +CREATE TABLE divisions (company_id INET6); +INSERT INTO divisions (company_id) values ('00::01'); +SELECT * FROM companies WHERE id IN (SELECT company_id FROM divisions); +UPDATE companies SET name = 'value' WHERE id IN (SELECT company_id FROM divisions); +SELECT * FROM companies; +DELETE FROM companies WHERE id IN (SELECT company_id FROM divisions); +SELECT * FROM companies; +DROP TABLE divisions; +DROP TABLE companies; diff --git a/plugin/type_inet/sql_type_inet.cc b/plugin/type_inet/sql_type_inet.cc index 26be505ac65..1c6e0e02e73 100644 --- a/plugin/type_inet/sql_type_inet.cc +++ b/plugin/type_inet/sql_type_inet.cc @@ -1109,9 +1109,14 @@ public: if (!example) return false; value_cached= true; - null_value= example->val_native_with_conversion_result(current_thd, - &m_value, - type_handler()); + /* + Merge comments: in 10.7 this code migrated to + Item_cache_fbt in to sql/sql_type_fixedbin.h + */ + null_value_inside= null_value= + example->val_native_with_conversion_result(current_thd, + &m_value, + type_handler()); return true; } String* val_str(String *to) |