Merge mysql.com:/home/ram/work/mysql-5.1-maint

into  mysql.com:/home/ram/work/b29444/b29444.5.1
parents 0783ae86 e908bb72
......@@ -1267,4 +1267,24 @@ ALTER TABLE general_log PARTITION BY RANGE (TO_DAYS(event_time))
ERROR HY000: Incorrect usage of PARTITION and log table
ALTER TABLE general_log ENGINE = CSV;
SET GLOBAL general_log = default;
use test;
create table t2 (b int);
create table t1 (b int)
PARTITION BY RANGE (t2.b) (
PARTITION p1 VALUES LESS THAN (10),
PARTITION p2 VALUES LESS THAN (20)
) select * from t2;
ERROR 42S22: Unknown column 't2.b' in 'partition function'
create table t1 (a int)
PARTITION BY RANGE (b) (
PARTITION p1 VALUES LESS THAN (10),
PARTITION p2 VALUES LESS THAN (20)
) select * from t2;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (b) (PARTITION p1 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (20) ENGINE = MyISAM) */
drop table t1, t2;
End of 5.1 tests
......@@ -1493,10 +1493,30 @@ ALTER TABLE general_log PARTITION BY RANGE (TO_DAYS(event_time))
(PARTITION p0 VALUES LESS THAN (733144), PARTITION p1 VALUES LESS THAN (3000000));
ALTER TABLE general_log ENGINE = CSV;
SET GLOBAL general_log = default;
use test;
#
# Bug #27084 partitioning by list seems failing when using case
# BUG #18198: Case no longer supported, test case removed
#
#
# Bug #29444: crash with partition refering to table in create-select
#
create table t2 (b int);
--error 1054
create table t1 (b int)
PARTITION BY RANGE (t2.b) (
PARTITION p1 VALUES LESS THAN (10),
PARTITION p2 VALUES LESS THAN (20)
) select * from t2;
create table t1 (a int)
PARTITION BY RANGE (b) (
PARTITION p1 VALUES LESS THAN (10),
PARTITION p2 VALUES LESS THAN (20)
) select * from t2;
show create table t1;
drop table t1, t2;
--echo End of 5.1 tests
......@@ -3860,6 +3860,8 @@ bool Item_field::fix_fields(THD *thd, Item **reference)
context->first_name_resolution_table,
context->last_name_resolution_table,
reference,
thd->lex->use_only_table_context ?
REPORT_ALL_ERRORS :
IGNORE_EXCEPT_NON_UNIQUE,
!any_privileges,
TRUE)) ==
......
......@@ -338,6 +338,7 @@ void lex_start(THD *thd)
lex->query_tables= 0;
lex->reset_query_tables_list(FALSE);
lex->expr_allows_subselect= TRUE;
lex->use_only_table_context= FALSE;
lex->name.str= 0;
lex->name.length= 0;
......
......@@ -1694,6 +1694,14 @@ typedef struct st_lex : public Query_tables_list
const char *fname_start;
const char *fname_end;
/**
During name resolution search only in the table list given by
Name_resolution_context::first_name_resolution_table and
Name_resolution_context::last_name_resolution_table
(see Item_field::fix_fields()).
*/
bool use_only_table_context;
LEX_STRING view_body_utf8;
/*
......
......@@ -902,6 +902,7 @@ bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table,
const char *save_where;
char* db_name;
char db_name_string[FN_REFLEN];
bool save_use_only_table_context;
DBUG_ENTER("fix_fields_part_func");
if (part_info->fixed)
......@@ -958,8 +959,14 @@ bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table,
This is a tricky call to prepare for since it can have a large number
of interesting side effects, both desirable and undesirable.
*/
save_use_only_table_context= thd->lex->use_only_table_context;
thd->lex->use_only_table_context= TRUE;
error= func_expr->fix_fields(thd, (Item**)0);
thd->lex->use_only_table_context= save_use_only_table_context;
context->table_list= save_table_list;
context->first_name_resolution_table= save_first_table;
context->last_name_resolution_table= save_last_table;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment