summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Shchepa <gleb.shchepa@oracle.com>2011-04-08 12:09:24 +0400
committerGleb Shchepa <gleb.shchepa@oracle.com>2011-04-08 12:09:24 +0400
commit71ffbd4651ad1131965ea39252e979bcc719f7de (patch)
treea882dbecbe9e5d691e50ad976300ec3274b5c79e
parent61dd7b36115df6eecc4843d63eaa38766e127638 (diff)
parentbd193c61e38bc2c734a06ef5213654737e876fd7 (diff)
downloadmariadb-git-71ffbd4651ad1131965ea39252e979bcc719f7de.tar.gz
manual merge 5.1-->5.5 (bug 11829681)
-rw-r--r--mysql-test/r/view.result9
-rw-r--r--mysql-test/t/view.test12
-rw-r--r--sql/item.cc2
-rw-r--r--sql/item.h4
4 files changed, 26 insertions, 1 deletions
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index fdeed10701d..ce404c7dce2 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -4012,6 +4012,15 @@ DROP TABLE t1;
#
CREATE VIEW v1 AS SELECT 1 IN (1 LIKE 2,0) AS f;
DROP VIEW v1;
+#
+# Bug 11829681 - 60295: ERROR 1356 ON VIEW THAT EXECUTES FINE AS A QUERY
+#
+CREATE TABLE t1 (a INT);
+CREATE VIEW v1 AS SELECT s.* FROM t1 s, t1 b HAVING a;
+SELECT * FROM v1;
+a
+DROP VIEW v1;
+DROP TABLE t1;
# -----------------------------------------------------------------
# -- End of 5.1 tests.
# -----------------------------------------------------------------
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index c82443e792f..39985bec339 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -3979,6 +3979,18 @@ DROP TABLE t1;
CREATE VIEW v1 AS SELECT 1 IN (1 LIKE 2,0) AS f;
DROP VIEW v1;
+--echo #
+--echo # Bug 11829681 - 60295: ERROR 1356 ON VIEW THAT EXECUTES FINE AS A QUERY
+--echo #
+
+CREATE TABLE t1 (a INT);
+CREATE VIEW v1 AS SELECT s.* FROM t1 s, t1 b HAVING a;
+
+SELECT * FROM v1;
+
+DROP VIEW v1;
+DROP TABLE t1;
+
--echo # -----------------------------------------------------------------
--echo # -- End of 5.1 tests.
--echo # -----------------------------------------------------------------
diff --git a/sql/item.cc b/sql/item.cc
index a63d07b9708..a1482a6d634 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -6479,7 +6479,7 @@ void Item_ref::print(String *str, enum_query_type query_type)
{
THD *thd= current_thd;
append_identifier(thd, str, (*ref)->real_item()->name,
- (*ref)->real_item()->name_length);
+ strlen((*ref)->real_item()->name));
}
else
(*ref)->print(str, query_type);
diff --git a/sql/item.h b/sql/item.h
index 6cd91f03604..3e67ffacfc8 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -548,6 +548,10 @@ public:
*/
Item *next;
uint32 max_length; /* Maximum length, in bytes */
+ /*
+ TODO: convert name and name_length fields into String to keep them in sync
+ (see bug #11829681/60295 etc).
+ */
uint name_length; /* Length of name */
int8 marker;
uint8 decimals;