summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <igor@olga.mysql.com>2006-07-24 19:05:46 -0700
committerunknown <igor@olga.mysql.com>2006-07-24 19:05:46 -0700
commitd64f605e48d42bc9a8fa33e206e427eab69b1a24 (patch)
tree194a76db647be171789dfeb4337ae020da046cc7 /mysql-test
parent800b160031066ccb31bd0efab42b522b3e42b7dd (diff)
downloadmariadb-git-d64f605e48d42bc9a8fa33e206e427eab69b1a24.tar.gz
Fixed bug #21231: wrong results for a simple query with a
a non-correlated single-row subquery over information schema. The function get_all_tables filling all information schema tables reset lex->sql_command to SQLCOM_SHOW_FIELDS. After this the function could evaluate partial conditions related to some columns. If these conditions contained a subquery over information schema it led to a wrong evaluation and a wrong result set. This bug was already fixed in 5.1. This patch follows the way how it was done in 5.1 where the value of lex->sql_command is set to SQLCOM_SHOW_FIELDS in get_all_tables only for the calls of the function open_normal_and_derived_tables and is restored after these calls. mysql-test/r/information_schema.result: Added a test case for bug #21231. mysql-test/t/information_schema.test: Added a test case for bug #21231.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/information_schema.result8
-rw-r--r--mysql-test/t/information_schema.test10
2 files changed, 18 insertions, 0 deletions
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index 3b3669119d5..652af1c8387 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -1232,3 +1232,11 @@ TABLE_PRIVILEGES TABLE_SCHEMA
TRIGGERS TRIGGER_SCHEMA
USER_PRIVILEGES GRANTEE
VIEWS TABLE_SCHEMA
+SELECT MAX(table_name) FROM information_schema.tables;
+MAX(table_name)
+VIEWS
+SELECT table_name from information_schema.tables
+WHERE table_name=(SELECT MAX(table_name)
+FROM information_schema.tables);
+table_name
+VIEWS
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index b49ec9e2f31..9e5dac8b853 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -920,4 +920,14 @@ SELECT t.table_name, c1.column_name
c2.column_name LIKE '%SCHEMA%'
);
+#
+# Bug#21231: query with a simple non-correlated subquery over
+# INFORMARTION_SCHEMA.TABLES
+#
+
+SELECT MAX(table_name) FROM information_schema.tables;
+SELECT table_name from information_schema.tables
+ WHERE table_name=(SELECT MAX(table_name)
+ FROM information_schema.tables);
+
# End of 5.0 tests.