Below is the list of changes that have just been committed into a local
5.0 repository of ram. When ram does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1782 05/03/03 14:29:37 ramil@stripped +3 -0
manual merge
sql/sql_union.cc
1.113 05/03/03 14:29:32 ramil@stripped +2 -2
manual merge
mysql-test/t/ps.test
1.32 05/03/03 14:29:32 ramil@stripped +10 -11
manual merge
mysql-test/r/ps.result
1.33 05/03/03 14:29:32 ramil@stripped +5 -5
manual merge
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: ramil
# Host: gw.mysql.r18.ru
# Root: /usr/home/ram/work/5.0/RESYNC
--- 1.112/sql/sql_union.cc 2005-02-25 18:53:16 +04:00
+++ 1.113/sql/sql_union.cc 2005-03-03 14:29:32 +04:00
@@ -217,8 +217,6 @@
thd_arg->lex->current_select= sl;
set_limit(sl, sl);
- if (sl->braces)
- sl->options&= ~OPTION_FOUND_ROWS;
can_skip_order_by= is_union &&
(!sl->braces || select_limit_cnt == HA_POS_ERROR);
@@ -342,10 +340,9 @@
if (arena->is_stmt_prepare())
{
/* prepare fake select to initialize it correctly */
- ulong options_tmp= init_prepare_fake_select_lex(thd);
+ (void) init_prepare_fake_select_lex(thd);
/*
- it should be done only once (because item_list builds only onece
- per statement)
+ Should be done only once (the only item_list per statement).
*/
DBUG_ASSERT(fake_select_lex->join == 0);
if (!(fake_select_lex->join= new JOIN(thd, item_list, thd->options,
@@ -452,21 +449,14 @@
if (select_limit_cnt < sl->select_limit)
select_limit_cnt= HA_POS_ERROR; // no limit
- /*
- When using braces, SQL_CALC_FOUND_ROWS affects the whole query.
- We don't calculate found_rows() per union part
- */
- if (select_limit_cnt == HA_POS_ERROR || sl->braces)
- sl->options&= ~OPTION_FOUND_ROWS;
- else
- {
- /*
- We are doing an union without braces. In this case
- SQL_CALC_FOUND_ROWS should be done on all sub parts
- */
- sl->options|= found_rows_for_union;
- }
- sl->join->select_options=sl->options;
+ /*
+ When using braces, SQL_CALC_FOUND_ROWS affects the whole query:
+ we don't calculate found_rows() per union part.
+ Otherwise, SQL_CALC_FOUND_ROWS should be done on all sub parts.
+ */
+ sl->join->select_options=
+ (select_limit_cnt == HA_POS_ERROR || sl->braces) ?
+ sl->options & ~OPTION_FOUND_ROWS : sl->options | found_rows_for_union;
res= sl->join->optimize();
}
if (!res)
@@ -498,7 +488,8 @@
}
/* Needed for the following test and for records_at_start in next loop */
table->file->info(HA_STATUS_VARIABLE);
- if (found_rows_for_union & sl->options)
+ if (found_rows_for_union && !sl->braces &&
+ select_limit_cnt != HA_POS_ERROR)
{
/*
This is a union without braces. Remember the number of rows that
--- 1.32/mysql-test/r/ps.result 2005-03-01 16:47:08 +04:00
+++ 1.33/mysql-test/r/ps.result 2005-03-03 14:29:32 +04:00
@@ -487,3 +487,15 @@
prepare stmt FROM 'SELECT char_length (a) FROM t1';
ERROR 42000: FUNCTION test.char_length does not exist
drop table t1;
+prepare stmt from "SELECT SQL_CALC_FOUND_ROWS 'foo' UNION SELECT 'bar' LIMIT 0";
+execute stmt;
+foo
+SELECT FOUND_ROWS();
+FOUND_ROWS()
+2
+execute stmt;
+foo
+SELECT FOUND_ROWS();
+FOUND_ROWS()
+2
+deallocate prepare stmt;
--- 1.31/mysql-test/t/ps.test 2004-12-22 15:54:26 +04:00
+++ 1.32/mysql-test/t/ps.test 2005-03-03 14:29:32 +04:00
@@ -497,3 +497,13 @@
prepare stmt FROM 'SELECT char_length (a) FROM t1';
drop table t1;
+#
+# Bug #6089: FOUND_ROWS returns wrong values when no table/view is used
+#
+
+prepare stmt from "SELECT SQL_CALC_FOUND_ROWS 'foo' UNION SELECT 'bar' LIMIT 0";
+execute stmt;
+SELECT FOUND_ROWS();
+execute stmt;
+SELECT FOUND_ROWS();
+deallocate prepare stmt;
| Thread |
|---|
| • bk commit into 5.0 tree (ramil:1.1782) | ramil | 3 Mar |