#At file:///mnt/raid/alik/MySQL/bzr/mysql-pe/ based on
revid:alik@stripped
3668 Alexander Nozdrin 2009-11-06 [merge]
Auto-merge from remote mysql-pe.
modified:
configure.in
mysql-test/r/innodb_mysql.result
mysql-test/r/olap.result
mysql-test/t/innodb_mysql.test
mysql-test/t/olap.test
sql/item_cmpfunc.cc
sql/sql_select.cc
=== modified file 'configure.in'
--- a/configure.in 2009-11-06 16:34:09 +0000
+++ b/configure.in 2009-11-06 16:36:04 +0000
@@ -21,6 +21,12 @@ NDB_VERSION_MINOR=2
NDB_VERSION_BUILD=17
NDB_VERSION_STATUS="-alpha"
+# Request support for automake silent-rules if available.
+# Default to verbose output. One can use the configure-time
+# option --enable-silent-rules or make V=1 to activate
+# silent rules.
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([no])])
+
PROTOCOL_VERSION=10
DOT_FRM_VERSION=6
# See the libtool docs for information on how to do shared lib versions.
=== modified file 'mysql-test/r/innodb_mysql.result'
--- a/mysql-test/r/innodb_mysql.result 2009-11-03 09:42:49 +0000
+++ b/mysql-test/r/innodb_mysql.result 2009-11-06 13:43:32 +0000
@@ -2282,6 +2282,28 @@ c >= '2009-10-09 00:00:00.001' AND c <=
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const
tables
DROP TABLE t1;
+#
+# Bug #46175: NULL read_view and consistent read assertion
+#
+CREATE TABLE t1(a CHAR(13),KEY(a)) ENGINE=innodb;
+CREATE TABLE t2(b DATETIME,KEY(b)) ENGINE=innodb;
+INSERT INTO t1 VALUES (),();
+INSERT INTO t2 VALUES (),();
+CREATE OR REPLACE VIEW v1 AS SELECT 1 FROM t2
+WHERE b =(SELECT a FROM t1 LIMIT 1);
+CREATE PROCEDURE p1(num INT)
+BEGIN
+DECLARE i INT DEFAULT 0;
+REPEAT
+SHOW CREATE VIEW v1;
+SET i:=i+1;
+UNTIL i>num END REPEAT;
+END|
+# Should not crash
+# Should not crash
+DROP PROCEDURE p1;
+DROP VIEW v1;
+DROP TABLE t1,t2;
End of 5.1 tests
#
# Test for bug #39932 "create table fails if column for FK is in different
=== modified file 'mysql-test/r/olap.result'
--- a/mysql-test/r/olap.result 2009-10-30 15:59:06 +0000
+++ b/mysql-test/r/olap.result 2009-11-06 14:54:19 +0000
@@ -753,4 +753,16 @@ b
100
NULL
DROP TABLE t1, t2;
+#
+# Bug #48475: DISTINCT is ignored with GROUP BY WITH ROLLUP
+# and only const tables
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (b INT);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+SELECT DISTINCT b FROM t1, t2 GROUP BY a, b WITH ROLLUP;
+b
+1
+NULL
+DROP TABLE t1, t2;
End of 5.0 tests
=== modified file 'mysql-test/t/innodb_mysql.test'
--- a/mysql-test/t/innodb_mysql.test 2009-11-03 09:42:49 +0000
+++ b/mysql-test/t/innodb_mysql.test 2009-11-06 13:43:32 +0000
@@ -489,6 +489,52 @@ EXPLAIN SELECT * FROM t1 WHERE a = 'TEST
c >= '2009-10-09 00:00:00.001' AND c <= '2009-10-09 00:00:00.00';
DROP TABLE t1;
+--echo #
+--echo # Bug #46175: NULL read_view and consistent read assertion
+--echo #
+
+CREATE TABLE t1(a CHAR(13),KEY(a)) ENGINE=innodb;
+CREATE TABLE t2(b DATETIME,KEY(b)) ENGINE=innodb;
+INSERT INTO t1 VALUES (),();
+INSERT INTO t2 VALUES (),();
+CREATE OR REPLACE VIEW v1 AS SELECT 1 FROM t2
+ WHERE b =(SELECT a FROM t1 LIMIT 1);
+
+--disable_query_log
+--disable_result_log
+CONNECT (con1, localhost, root,,);
+--enable_query_log
+--enable_result_log
+CONNECTION default;
+
+DELIMITER |;
+CREATE PROCEDURE p1(num INT)
+BEGIN
+ DECLARE i INT DEFAULT 0;
+ REPEAT
+ SHOW CREATE VIEW v1;
+ SET i:=i+1;
+ UNTIL i>num END REPEAT;
+END|
+DELIMITER ;|
+
+--echo # Should not crash
+--disable_query_log
+--disable_result_log
+--send CALL p1(1000)
+CONNECTION con1;
+--echo # Should not crash
+CALL p1(1000);
+
+CONNECTION default;
+--reap
+--enable_query_log
+--enable_result_log
+
+DISCONNECT con1;
+DROP PROCEDURE p1;
+DROP VIEW v1;
+DROP TABLE t1,t2;
--echo End of 5.1 tests
=== modified file 'mysql-test/t/olap.test'
--- a/mysql-test/t/olap.test 2009-10-30 15:54:53 +0000
+++ b/mysql-test/t/olap.test 2009-11-06 06:44:01 +0000
@@ -390,4 +390,17 @@ SELECT DISTINCT b FROM t1, t2 GROUP BY a
DROP TABLE t1, t2;
+--echo #
+--echo # Bug #48475: DISTINCT is ignored with GROUP BY WITH ROLLUP
+--echo # and only const tables
+
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (b INT);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+
+SELECT DISTINCT b FROM t1, t2 GROUP BY a, b WITH ROLLUP;
+
+DROP TABLE t1, t2;
+
--echo End of 5.0 tests
=== modified file 'sql/item_cmpfunc.cc'
--- a/sql/item_cmpfunc.cc 2009-11-03 12:58:06 +0000
+++ b/sql/item_cmpfunc.cc 2009-11-06 13:43:32 +0000
@@ -785,15 +785,21 @@ Arg_comparator::can_compare_as_dates(Ite
if (cmp_type != CMP_DATE_DFLT)
{
+ THD *thd= current_thd;
/*
Do not cache GET_USER_VAR() function as its const_item() may return TRUE
for the current thread but it still may change during the execution.
+ Don't use cache while in the context analysis mode only (i.e. for
+ EXPLAIN/CREATE VIEW and similar queries). Cache is useless in such
+ cases and can cause problems. For example evaluating subqueries can
+ confuse storage engines since in context analysis mode tables
+ aren't locked.
*/
- if (cmp_type != CMP_DATE_WITH_DATE && str_arg->const_item() &&
+ if (!thd->is_context_analysis_only() &&
+ cmp_type != CMP_DATE_WITH_DATE && str_arg->const_item() &&
(str_arg->type() != Item::FUNC_ITEM ||
((Item_func*)str_arg)->functype() != Item_func::GUSERVAR_FUNC))
{
- THD *thd= current_thd;
ulonglong value;
bool error;
String tmp, *str_val= 0;
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2009-11-06 16:34:09 +0000
+++ b/sql/sql_select.cc 2009-11-06 16:36:04 +0000
@@ -1636,14 +1636,20 @@ JOIN::optimize()
DBUG_RETURN(1);
}
- if (select_lex->olap == ROLLUP_TYPE && rollup_process_const_fields())
+ if (rollup.state != ROLLUP::STATE_NONE)
{
- DBUG_PRINT("error", ("Error: rollup_process_fields() failed"));
- DBUG_RETURN(1);
+ if (rollup_process_const_fields())
+ {
+ DBUG_PRINT("error", ("Error: rollup_process_fields() failed"));
+ DBUG_RETURN(1);
+ }
+ }
+ else
+ {
+ /* Remove distinct if only const tables */
+ select_distinct= select_distinct && (const_tables != tables);
}
- /* Remove distinct if only const tables */
- select_distinct= select_distinct && (const_tables != tables);
thd_proc_info(thd, "preparing");
if (result->initialize_tables(this))
{
@@ -1937,11 +1943,14 @@ JOIN::optimize()
- We are using an ORDER BY or GROUP BY on fields not in the first table
- We are using different ORDER BY and GROUP BY orders
- The user wants us to buffer the result.
+ When the WITH ROLLUP modifier is present, we cannot skip temporary table
+ creation for the DISTINCT clause just because there are only const tables.
*/
- need_tmp= (const_tables != tables &&
+ need_tmp= ((const_tables != tables &&
((select_distinct || !simple_order || !simple_group) ||
(group_list && order) ||
- test(select_options & OPTION_BUFFER_RESULT)));
+ test(select_options & OPTION_BUFFER_RESULT))) ||
+ rollup.state != ROLLUP::STATE_NONE && select_distinct);
/*
If the hint FORCE INDEX FOR ORDER BY/GROUP BY is used for the table
Attachment: [text/bzr-bundle] bzr/alik@sun.com-20091106163604-j290sq5sbmewz4n1.bundle
| Thread |
|---|
| • bzr commit into mysql-pe branch (alik:3668) | Alexander Nozdrin | 6 Nov 2009 |