Commit 7663773e authored by Alexander Barkov's avatar Alexander Barkov

MDEV-11160 "Incorrect column name" when "CREATE TABLE t1 AS SELECT spvar"

This problem was earlier fixed in bb-10.2-ext.
Adding tests only.
parent ac8e0507
...@@ -2404,3 +2404,31 @@ t1 CREATE TABLE "t1" ( ...@@ -2404,3 +2404,31 @@ t1 CREATE TABLE "t1" (
"aa_timestamp5" timestamp(5) NULL DEFAULT NULL, "aa_timestamp5" timestamp(5) NULL DEFAULT NULL,
"aa_date0" datetime DEFAULT NULL "aa_date0" datetime DEFAULT NULL
) )
#
# MDEV-11160 "Incorrect column name" when "CREATE TABLE t1 AS SELECT spvar"
#
CREATE TABLE t1 (x INT);
INSERT INTO t1 VALUES (10);
CREATE VIEW v1 AS SELECT x+1 AS a,x+1 AS b FROM t1;
CREATE PROCEDURE p1
AS
a INT := 1;
b INT := 2;
BEGIN
CREATE TABLE t2 AS SELECT a,b FROM v1;
SHOW CREATE TABLE t2;
SELECT * FROM t2;
DROP TABLE t2;
END;
$$
CALL p1();
Table Create Table
t2 CREATE TABLE "t2" (
"a" int(11) DEFAULT NULL,
"b" int(11) DEFAULT NULL
)
a b
1 2
DROP PROCEDURE p1;
DROP VIEW v1;
DROP TABLE t1;
...@@ -2233,3 +2233,30 @@ BEGIN ...@@ -2233,3 +2233,30 @@ BEGIN
END; END;
$$ $$
DELIMITER ;$$ DELIMITER ;$$
--echo #
--echo # MDEV-11160 "Incorrect column name" when "CREATE TABLE t1 AS SELECT spvar"
--echo #
CREATE TABLE t1 (x INT);
INSERT INTO t1 VALUES (10);
CREATE VIEW v1 AS SELECT x+1 AS a,x+1 AS b FROM t1;
DELIMITER $$;
CREATE PROCEDURE p1
AS
a INT := 1;
b INT := 2;
BEGIN
CREATE TABLE t2 AS SELECT a,b FROM v1;
SHOW CREATE TABLE t2;
SELECT * FROM t2;
DROP TABLE t2;
END;
$$
DELIMITER ;$$
CALL p1();
DROP PROCEDURE p1;
DROP VIEW v1;
DROP TABLE t1;
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