summaryrefslogtreecommitdiff
path: root/mysql-test/t/view.test
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2011-07-11 10:56:48 -0700
committerIgor Babaev <igor@askmonty.org>2011-07-11 10:56:48 -0700
commit47aee19827743f0fd9e6af45713b4e1ed6365576 (patch)
treee020bef635a4e127d92d6da67c9c55e85327ac00 /mysql-test/t/view.test
parentf8db35bd157f0e1c78cb86cb61200a9aaf7998c1 (diff)
downloadmariadb-git-47aee19827743f0fd9e6af45713b4e1ed6365576.tar.gz
Fixed LP bug #793386.
Auto-generated names for view field items must be allocated in the statement memory, not in the execution memory of the statement.
Diffstat (limited to 'mysql-test/t/view.test')
-rw-r--r--mysql-test/t/view.test22
1 files changed, 22 insertions, 0 deletions
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index bef2e2a2402..9eafae1729f 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -4213,3 +4213,25 @@ SELECT * FROM (SELECT b FROM v2 WHERE b = 0) t WHERE b;
DROP VIEW v1,v2;
DROP TABLE t1;
+
+--echo #
+--echo # LP bug #793386: unexpected 'Duplicate column name ''' error
+--echo # at the second execution of a PS using a view
+--echo #
+
+CREATE TABLE t1 (f1 int, f2 int, f3 int, f4 int);
+
+CREATE VIEW v1 AS
+ SELECT t.f1, t.f2, s.f3, s.f4 FROM t1 t, t1 s
+ WHERE t.f4 >= s.f2 AND s.f3 < 0;
+
+PREPARE stmt1 FROM
+ "SELECT s.f1 AS f1, s.f2 AS f2, s.f3 AS f3, t.f4 AS f4
+ FROM v1 AS t LEFT JOIN v1 AS s ON t.f4=s.f4 WHERE t.f2 <> 1225";
+EXECUTE stmt1;
+EXECUTE stmt1;
+
+DEALLOCATE PREPARE stmt1;
+
+DROP VIEW v1;
+DROP TABLE t1;