Commit 477776bf authored by Alexander Barkov's avatar Alexander Barkov

MDEV-28491 Uuid. "UPDATE/DELETE" not working "WHERE id IN (SELECT id FROM ..)"

This is a 10.7 version of the patch.
parent 712b443a
......@@ -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;
......@@ -1612,3 +1612,20 @@ 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;
......@@ -3152,3 +3152,22 @@ f var_pop('x')
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'x'
Warning 1292 Incorrect uuid value: ''
#
# MDEV-28491 Uuid. "UPDATE/DELETE" not working "WHERE id IN (SELECT id FROM ..)"
#
CREATE TABLE companies (id uuid, name varchar(10));
INSERT INTO companies (id) values ('7bc95b06-cc6c-11ec-96c5-0242ac130002');
CREATE TABLE divisions (company_id uuid);
INSERT INTO divisions (company_id) values ('7bc95b06-cc6c-11ec-96c5-0242ac130002');
SELECT * FROM companies WHERE id IN (SELECT company_id FROM divisions);
id name
7bc95b06-cc6c-11ec-96c5-0242ac130002 NULL
UPDATE companies SET name = 'value' WHERE id IN (SELECT company_id FROM divisions);
SELECT * FROM companies;
id name
7bc95b06-cc6c-11ec-96c5-0242ac130002 value
DELETE FROM companies WHERE id IN (SELECT company_id FROM divisions);
SELECT * FROM companies;
id name
DROP TABLE divisions;
DROP TABLE companies;
......@@ -1652,3 +1652,21 @@ DROP TABLE t1;
--echo #
SELECT uuid() AS f, var_pop('x') FROM dual HAVING f > '';
--echo #
--echo # MDEV-28491 Uuid. "UPDATE/DELETE" not working "WHERE id IN (SELECT id FROM ..)"
--echo #
CREATE TABLE companies (id uuid, name varchar(10));
INSERT INTO companies (id) values ('7bc95b06-cc6c-11ec-96c5-0242ac130002');
CREATE TABLE divisions (company_id uuid);
INSERT INTO divisions (company_id) values ('7bc95b06-cc6c-11ec-96c5-0242ac130002');
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;
......@@ -1589,8 +1589,9 @@ class FixedBinTypeBundle
if (!example)
return false;
value_cached= true;
null_value= example->val_native_with_conversion_result(current_thd,
&m_value, type_handler());
null_value_inside= null_value=
example->val_native_with_conversion_result(current_thd,
&m_value, type_handler());
return true;
}
String* val_str(String *to)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment