diff options
author | unknown <msvensson@neptunus.(none)> | 2005-03-30 14:32:53 +0200 |
---|---|---|
committer | unknown <msvensson@neptunus.(none)> | 2005-03-30 14:32:53 +0200 |
commit | f17bba4e2d93fe8343bc1230ef9ef2248cd80246 (patch) | |
tree | 6d4d58f868c686f29d5acf8aefd03ffdf2bb27cf | |
parent | 8d8cb24efb8dd763c44bbf7b97dfe719e0550023 (diff) | |
parent | ed4022bdd165ca4da93e0d3f7520819b1e10fe00 (diff) | |
download | mariadb-git-f17bba4e2d93fe8343bc1230ef9ef2248cd80246.tar.gz |
Merge
mysql-test/r/ps_2myisam.result:
Auto merged
mysql-test/r/ps_3innodb.result:
Auto merged
mysql-test/r/ps_4heap.result:
Auto merged
mysql-test/r/ps_5merge.result:
Auto merged
mysql-test/r/ps_6bdb.result:
Auto merged
mysql-test/r/ps_7ndb.result:
Auto merged
sql/item.h:
Auto merged
sql/item_subselect.h:
Auto merged
sql/item.cc:
SCCS merged
-rw-r--r-- | mysql-test/include/ps_query.inc | 5 | ||||
-rw-r--r-- | mysql-test/r/ps_2myisam.result | 4 | ||||
-rw-r--r-- | mysql-test/r/ps_3innodb.result | 4 | ||||
-rw-r--r-- | mysql-test/r/ps_4heap.result | 4 | ||||
-rw-r--r-- | mysql-test/r/ps_5merge.result | 8 | ||||
-rw-r--r-- | mysql-test/r/ps_6bdb.result | 4 | ||||
-rw-r--r-- | mysql-test/r/ps_7ndb.result | 4 | ||||
-rw-r--r-- | sql/item.cc | 28 | ||||
-rw-r--r-- | sql/item.h | 1 | ||||
-rw-r--r-- | sql/item_subselect.h | 1 |
10 files changed, 63 insertions, 0 deletions
diff --git a/mysql-test/include/ps_query.inc b/mysql-test/include/ps_query.inc index e6f19c67138..9a413bff2f3 100644 --- a/mysql-test/include/ps_query.inc +++ b/mysql-test/include/ps_query.inc @@ -421,6 +421,11 @@ prepare stmt1 from ' select a, ?, b FROM t1 outer_table where 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 diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result index a41a497f1b4..37c3682cacd 100644 --- a/mysql-test/r/ps_2myisam.result +++ b/mysql-test/r/ps_2myisam.result @@ -768,6 +768,10 @@ prepare stmt1 from ' select a, ?, b FROM t1 outer_table where 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 ; diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result index 8dc8d4016fb..d56fcb96726 100644 --- a/mysql-test/r/ps_3innodb.result +++ b/mysql-test/r/ps_3innodb.result @@ -768,6 +768,10 @@ prepare stmt1 from ' select a, ?, b FROM t1 outer_table where 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 ; diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result index 40623f95590..899299fa36c 100644 --- a/mysql-test/r/ps_4heap.result +++ b/mysql-test/r/ps_4heap.result @@ -769,6 +769,10 @@ prepare stmt1 from ' select a, ?, b FROM t1 outer_table where 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 ; diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result index 4e002e6d254..4a53fe47f3f 100644 --- a/mysql-test/r/ps_5merge.result +++ b/mysql-test/r/ps_5merge.result @@ -811,6 +811,10 @@ prepare stmt1 from ' select a, ?, b FROM t1 outer_table where 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 ; @@ -3820,6 +3824,10 @@ prepare stmt1 from ' select a, ?, b FROM t1 outer_table where 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 ; diff --git a/mysql-test/r/ps_6bdb.result b/mysql-test/r/ps_6bdb.result index f599deba7a4..8ea5b092b5e 100644 --- a/mysql-test/r/ps_6bdb.result +++ b/mysql-test/r/ps_6bdb.result @@ -768,6 +768,10 @@ prepare stmt1 from ' select a, ?, b FROM t1 outer_table where 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 ; diff --git a/mysql-test/r/ps_7ndb.result b/mysql-test/r/ps_7ndb.result index 01214d3dfe8..ec8c47031c1 100644 --- a/mysql-test/r/ps_7ndb.result +++ b/mysql-test/r/ps_7ndb.result @@ -768,6 +768,10 @@ prepare stmt1 from ' select a, ?, b FROM t1 outer_table where 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 ; diff --git a/sql/item.cc b/sql/item.cc index 457aa774352..78cd0b4cf17 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -2094,6 +2094,34 @@ bool Item_param::convert_str_value(THD *thd) 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 subselect should mark the subselect as not constant + during prepare + */ + if (state == NO_VALUE) + { + /* + SELECT_LEX_UNIT::item set only for subqueries, so test of it presence + can be barrier to stop before derived table SELECT or very outer SELECT + */ + for(; + cursel->master_unit()->item; + cursel= cursel->outer_select()) + { + Item_subselect *subselect_item= cursel->master_unit()->item; + subselect_item->used_tables_cache|= OUTER_REF_TABLE_BIT; + subselect_item->const_item_cache= 0; + } + } + fixed= 1; + return 0; +} + void Item_param::print(String *str) { diff --git a/sql/item.h b/sql/item.h index 55c9af356a8..b8a6c43d278 100644 --- a/sql/item.h +++ b/sql/item.h @@ -882,6 +882,7 @@ public: 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); diff --git a/sql/item_subselect.h b/sql/item_subselect.h index 4661fae81da..1adefb6492e 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -120,6 +120,7 @@ public: 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 */ |