summaryrefslogtreecommitdiff
path: root/mysql-test/main/union.result
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2021-07-27 23:45:30 +0200
committerNikita Malyavin <nikitamalyavin@gmail.com>2021-07-29 02:08:23 +0300
commit6152ab7b42c18d62030ef9c23e9abb3817c73f39 (patch)
tree06cbca41de549b23519f1c8c7a86f1e55e99e6f9 /mysql-test/main/union.result
parentc86f813afe372a9dffc1badbc8f26e35e9d44b29 (diff)
downloadmariadb-git-6152ab7b42c18d62030ef9c23e9abb3817c73f39.tar.gz
MDEV-24511 null field is created with CREATE..SELECT
When creating fields for UNION results, Field_null is not allowed. Should create binary(0) instead.
Diffstat (limited to 'mysql-test/main/union.result')
-rw-r--r--mysql-test/main/union.result31
1 files changed, 30 insertions, 1 deletions
diff --git a/mysql-test/main/union.result b/mysql-test/main/union.result
index a892f6c9e40..011d65578cb 100644
--- a/mysql-test/main/union.result
+++ b/mysql-test/main/union.result
@@ -1609,7 +1609,7 @@ NULL binary(0) YES NULL
CREATE TABLE t5 SELECT NULL UNION SELECT NULL;
DESC t5;
Field Type Null Key Default Extra
-NULL null YES NULL
+NULL binary(0) YES NULL
CREATE TABLE t6
SELECT * FROM (SELECT * FROM (SELECT NULL)a) b UNION SELECT a FROM t1;
DESC t6;
@@ -2635,5 +2635,34 @@ CAST(1 AS UNSIGNED)
1
1
#
+# MDEV-24511 null field is created with CREATE..SELECT
+#
+set @save_default_storage_engine=@@default_storage_engine;
+SET @@default_storage_engine=MEMORY;
+CREATE TABLE t1 SELECT NULL UNION SELECT NULL;
+ALTER TABLE t1 ADD INDEX (`PRIMARY`);
+ERROR 42000: Key column 'PRIMARY' doesn't exist in table
+CREATE TABLE t2 SELECT NULL;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `NULL` binary(0) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1
+CREATE TABLE t3 SELECT NULL UNION SELECT NULL;
+SHOW CREATE TABLE t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `NULL` binary(0) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1
+CREATE OR REPLACE TABLE t4 SELECT NULL UNION SELECT NULL;
+SHOW CREATE TABLE t4;
+Table Create Table
+t4 CREATE TABLE `t4` (
+ `NULL` binary(0) DEFAULT NULL
+) ENGINE=MEMORY DEFAULT CHARSET=latin1
+ALTER TABLE t4 ADD INDEX (`NULL`);
+DROP TABLE t1, t2, t3, t4;
+set @@default_storage_engine=@save_default_storage_engine;
+#
# End of 10.3 tests
#