summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <vva@genie.(none)>2002-11-25 14:32:44 +0400
committerunknown <vva@genie.(none)>2002-11-25 14:32:44 +0400
commit4842f59088a23777daa867061b83e6d6c71851c7 (patch)
tree4121232f4e8ef16d660ac4e35de62ce4e191c13c
parentc06421ae06275d348209b157cabf7897a38fff95 (diff)
parent83b4c4d618fc500a0a0360aafb62230523a17a86 (diff)
downloadmariadb-git-4842f59088a23777daa867061b83e6d6c71851c7.tar.gz
Merge vvagin@work.mysql.com:/home/bk/mysql-4.1
into genie.(none):/home/vva/work/new_readline/4.1
-rw-r--r--mysql-test/r/subselect.result2
-rw-r--r--mysql-test/t/subselect.test2
-rw-r--r--sql/item.cc5
-rw-r--r--sql/opt_range.cc4
4 files changed, 10 insertions, 3 deletions
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index ef4da19c826..5a8ff20aa33 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -30,6 +30,8 @@ Unknown column 'a' in 'field list'
SELECT 1 as a FROM (SELECT 1) HAVING (SELECT a)=1;
a
1
+SELECT 1 FROM (SELECT (SELECT a));
+Unknown column 'a' in 'field list'
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8;
create table t1 (a int);
create table t2 (a int, b int);
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 6d4fc7de30b..00f3a4f6e44 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -13,6 +13,8 @@ SELECT 1 FROM (SELECT 1 as a) HAVING (SELECT a)=1;
-- error 1054
SELECT (SELECT 1), a;
SELECT 1 as a FROM (SELECT 1) HAVING (SELECT a)=1;
+-- error 1054
+SELECT 1 FROM (SELECT (SELECT a));
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8;
create table t1 (a int);
create table t2 (a int, b int);
diff --git a/sql/item.cc b/sql/item.cc
index 13433990107..df42b9185cc 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -472,7 +472,8 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
REPORT_EXCEPT_NOT_FOUND)) !=
(Item **)not_found_item)
break;
-
+ if (sl->linkage == DERIVED_TABLE_TYPE)
+ break; // do not look over derived table
}
if (!tmp)
return -1;
@@ -887,6 +888,8 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
if ((tmp= find_field_in_tables(thd, this,
sl->get_table_list(),
0)) != not_found_field);
+ if (sl->linkage == DERIVED_TABLE_TYPE)
+ break; // do not look over derived table
}
if (!ref)
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index b6f81ab07eb..cee5502fb32 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -932,7 +932,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
String tmp(buff1,sizeof(buff1),default_charset_info),*res;
uint length,offset,min_length,max_length;
- if (!field->optimize_range((uint) key_part->key))
+ if (!field->optimize_range(param->real_keynr[key_part->key]))
DBUG_RETURN(0); // Can't optimize this
if (!(res= value->val_str(&tmp)))
DBUG_RETURN(&null_element);
@@ -1002,7 +1002,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
DBUG_RETURN(tree);
}
- if (!field->optimize_range((uint) key_part->key) &&
+ if (!field->optimize_range(param->real_keynr[key_part->key]) &&
type != Item_func::EQ_FUNC &&
type != Item_func::EQUAL_FUNC)
DBUG_RETURN(0); // Can't optimize this