Below is the list of changes that have just been committed into a local
4.1 repository of msvensson. When msvensson 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.2141 05/03/24 19:13:33 msvensson@neptunus.(none) +10 -0
BUG#8807 Select crash server
- Add function Item_param::fix_fields which will update any subselect they are part of
and indicate that the subsleect is not const during prepare phase, and thus should not be
executed during prepare.
sql/item_subselect.h
1.59 05/03/24 19:13:30 msvensson@neptunus.(none) +1 -0
Make Item_param::fix_field friend of Item_subselect
sql/item.h
1.175 05/03/24 19:13:30 msvensson@neptunus.(none) +1 -0
Adde Item_param::fix_fields
sql/item.cc
1.195 05/03/24 19:13:30 msvensson@neptunus.(none) +26 -0
Add function Item_param::fix_fields, which will mark any subselects they are part of
as not being a constant expression unless the param value is specified, ie. it will be
not be constant during prepare phase.
mysql-test/r/ps_7ndb.result
1.15 05/03/24 19:13:30 msvensson@neptunus.(none) +4 -0
Update test result
mysql-test/r/ps_6bdb.result
1.22 05/03/24 19:13:30 msvensson@neptunus.(none) +4 -0
Update test result
mysql-test/r/ps_5merge.result
1.21 05/03/24 19:13:30 msvensson@neptunus.(none) +8 -0
Update test result
mysql-test/r/ps_4heap.result
1.21 05/03/24 19:13:30 msvensson@neptunus.(none) +4 -0
Update test result
mysql-test/r/ps_3innodb.result
1.23 05/03/24 19:13:30 msvensson@neptunus.(none) +4 -0
Update test result
mysql-test/r/ps_2myisam.result
1.22 05/03/24 19:13:30 msvensson@neptunus.(none) +4 -0
Update test result
mysql-test/include/ps_query.inc
1.11 05/03/24 19:13:30 msvensson@neptunus.(none) +5 -0
Adde new test case
# 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: msvensson
# Host: neptunus.(none)
# Root: /home/msvensson/mysql/bug8807
--- 1.194/sql/item.cc 2005-03-15 14:15:43 +01:00
+++ 1.195/sql/item.cc 2005-03-24 19:13:30 +01:00
@@ -1319,6 +1319,32 @@
return rc;
}
+bool Item_param::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
+{
+ DBUG_ASSERT(fixed == 0);
+ SELECT_LEX *cursel= (SELECT_LEX *) thd->lex->current_select;
+
+ /*
+ Parameters in a subsleect should mark the subselect as not constant
+ during prepare
+ */
+ if ((state == NO_VALUE) &&
+ cursel->master_unit()->first_select()->linkage != DERIVED_TABLE_TYPE)
+ {
+ SELECT_LEX_UNIT *prev_unit= cursel->master_unit();
+ for (SELECT_LEX *outer_sel= prev_unit->outer_select();
+ outer_sel;
+ outer_sel= (prev_unit= outer_sel->master_unit())->outer_select())
+ {
+ Item_subselect *prev_subselect_item= prev_unit->item;
+ prev_subselect_item->used_tables_cache|= OUTER_REF_TABLE_BIT;
+ prev_subselect_item->const_item_cache= 0;
+ }
+ }
+ fixed= 1;
+ return 0;
+}
+
/* End of Item_param related */
--- 1.174/sql/item.h 2005-03-17 02:49:58 +01:00
+++ 1.175/sql/item.h 2005-03-24 19:13:30 +01:00
@@ -559,6 +559,7 @@
bool get_time(TIME *tm);
bool get_date(TIME *tm, uint fuzzydate);
int save_in_field(Field *field, bool no_conversions);
+ bool fix_fields(THD *, struct st_table_list *, Item **);
void set_null();
void set_int(longlong i, uint32 max_length_arg);
--- 1.58/sql/item_subselect.h 2004-12-07 20:18:12 +01:00
+++ 1.59/sql/item_subselect.h 2005-03-24 19:13:30 +01:00
@@ -119,6 +119,7 @@
friend class Item_in_optimizer;
friend bool Item_field::fix_fields(THD *, TABLE_LIST *, Item **);
friend bool Item_ref::fix_fields(THD *, TABLE_LIST *, Item **);
+ friend bool Item_param::fix_fields(THD *, TABLE_LIST *, Item **);
};
/* single value subselect */
--- 1.10/mysql-test/include/ps_query.inc 2004-10-11 22:58:44 +02:00
+++ 1.11/mysql-test/include/ps_query.inc 2005-03-24 19:13:30 +01:00
@@ -421,6 +421,11 @@
b=? and a = (select ? from t1 where b = ? ) ' ;
execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
+# Bug#8807
+prepare stmt1 from 'select c4 FROM t9 where
+ c13 = (select MAX(b) from t1 where a = ?) and c22 = ? ' ;
+execute stmt1 using @arg01, @arg02;
+
######## correlated subquery
# no parameter
prepare stmt1 from ' select a, b FROM t1 outer_table where
--- 1.21/mysql-test/r/ps_2myisam.result 2005-01-18 14:41:02 +01:00
+++ 1.22/mysql-test/r/ps_2myisam.result 2005-03-24 19:13:30 +01:00
@@ -768,6 +768,10 @@
execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
a ? b
2 1 two
+prepare stmt1 from 'select c4 FROM t9 where
+ c13 = (select MAX(b) from t1 where a = ?) and c22 = ? ' ;
+execute stmt1 using @arg01, @arg02;
+c4
prepare stmt1 from ' select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b ) order by a ';
execute stmt1 ;
--- 1.22/mysql-test/r/ps_3innodb.result 2005-01-18 14:41:02 +01:00
+++ 1.23/mysql-test/r/ps_3innodb.result 2005-03-24 19:13:30 +01:00
@@ -768,6 +768,10 @@
execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
a ? b
2 1 two
+prepare stmt1 from 'select c4 FROM t9 where
+ c13 = (select MAX(b) from t1 where a = ?) and c22 = ? ' ;
+execute stmt1 using @arg01, @arg02;
+c4
prepare stmt1 from ' select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b ) order by a ';
execute stmt1 ;
--- 1.20/mysql-test/r/ps_4heap.result 2005-01-18 14:41:02 +01:00
+++ 1.21/mysql-test/r/ps_4heap.result 2005-03-24 19:13:30 +01:00
@@ -769,6 +769,10 @@
execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
a ? b
2 1 two
+prepare stmt1 from 'select c4 FROM t9 where
+ c13 = (select MAX(b) from t1 where a = ?) and c22 = ? ' ;
+execute stmt1 using @arg01, @arg02;
+c4
prepare stmt1 from ' select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b ) order by a ';
execute stmt1 ;
--- 1.20/mysql-test/r/ps_5merge.result 2005-01-18 14:41:02 +01:00
+++ 1.21/mysql-test/r/ps_5merge.result 2005-03-24 19:13:30 +01:00
@@ -811,6 +811,10 @@
execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
a ? b
2 1 two
+prepare stmt1 from 'select c4 FROM t9 where
+ c13 = (select MAX(b) from t1 where a = ?) and c22 = ? ' ;
+execute stmt1 using @arg01, @arg02;
+c4
prepare stmt1 from ' select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b ) order by a ';
execute stmt1 ;
@@ -3821,6 +3825,10 @@
execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
a ? b
2 1 two
+prepare stmt1 from 'select c4 FROM t9 where
+ c13 = (select MAX(b) from t1 where a = ?) and c22 = ? ' ;
+execute stmt1 using @arg01, @arg02;
+c4
prepare stmt1 from ' select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b ) order by a ';
execute stmt1 ;
--- 1.21/mysql-test/r/ps_6bdb.result 2005-01-18 14:41:02 +01:00
+++ 1.22/mysql-test/r/ps_6bdb.result 2005-03-24 19:13:30 +01:00
@@ -768,6 +768,10 @@
execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
a ? b
2 1 two
+prepare stmt1 from 'select c4 FROM t9 where
+ c13 = (select MAX(b) from t1 where a = ?) and c22 = ? ' ;
+execute stmt1 using @arg01, @arg02;
+c4
prepare stmt1 from ' select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b ) order by a ';
execute stmt1 ;
--- 1.14/mysql-test/r/ps_7ndb.result 2005-01-18 14:41:02 +01:00
+++ 1.15/mysql-test/r/ps_7ndb.result 2005-03-24 19:13:30 +01:00
@@ -768,6 +768,10 @@
execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
a ? b
2 1 two
+prepare stmt1 from 'select c4 FROM t9 where
+ c13 = (select MAX(b) from t1 where a = ?) and c22 = ? ' ;
+execute stmt1 using @arg01, @arg02;
+c4
prepare stmt1 from ' select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b ) order by a ';
execute stmt1 ;
| Thread |
|---|
| • bk commit into 4.1 tree (msvensson:1.2141) BUG#8807 | msvensson | 24 Mar |