summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2003-08-12 15:04:49 +0300
committerunknown <bell@sanja.is.com.ua>2003-08-12 15:04:49 +0300
commit45b145a96e9a5992b8a5c8a0a1a23d99951058ca (patch)
tree9b6eb05bbb347e1704e9fe0036f80dc793830074 /sql/sql_select.cc
parent253b2a9654f6430d879076771b70bd018dd30732 (diff)
downloadmariadb-git-45b145a96e9a5992b8a5c8a0a1a23d99951058ca.tar.gz
fixed problem with reference on derived table fields (BUG#1031)
mysql-test/r/derived.result: test of BUG#1031 mysql-test/t/derived.test: test of BUG#1031 sql/item_sum.cc: 'alias' parameter added to create_tmp_table sql/sql_derived.cc: Derived table should be named (to pass it name to Field and then to Item_field) sql/sql_select.cc: 'alias' parameter added to create_tmp_table sql/sql_select.h: 'alias' parameter added to create_tmp_table sql/sql_union.cc: 'alias' parameter added to create_tmp_table sql/sql_update.cc: 'alias' parameter added to create_tmp_table
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 71c0d0bdddc..a2ef96b7990 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -787,7 +787,8 @@ JOIN::optimize()
group_list && simple_group,
select_options,
(order == 0 || skip_sort_order) ? select_limit :
- HA_POS_ERROR)))
+ HA_POS_ERROR,
+ (char *) "")))
DBUG_RETURN(1);
/*
@@ -1120,7 +1121,8 @@ JOIN::exec()
curr_join->select_distinct &&
!curr_join->group_list,
1, curr_join->select_options,
- HA_POS_ERROR)))
+ HA_POS_ERROR,
+ (char *) "")))
DBUG_VOID_RETURN;
curr_join->exec_tmp_table2= exec_tmp_table2;
}
@@ -4321,7 +4323,8 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
TABLE *
create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
ORDER *group, bool distinct, bool save_sum_fields,
- ulong select_options, ha_rows rows_limit)
+ ulong select_options, ha_rows rows_limit,
+ char *table_alias)
{
TABLE *table;
uint i,field_count,reclength,null_count,null_pack_length,
@@ -4410,10 +4413,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
table->field=reg_field;
table->blob_field= (Field_blob**) blob_field;
table->real_name=table->path=tmpname;
- /*
- This must be "" as field may refer to it after tempory table is dropped
- */
- table->table_name= (char*) "";
+ table->table_name= table_alias;
table->reginfo.lock_type=TL_WRITE; /* Will be updated */
table->db_stat=HA_OPEN_KEYFILE+HA_OPEN_RNDFILE;
table->blob_ptr_size=mi_portable_sizeof_char_ptr;