summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2003-10-19 14:25:33 +0300
committerunknown <bell@sanja.is.com.ua>2003-10-19 14:25:33 +0300
commitbe4e254b132987a41ec034217e9fde2c15cfc0d7 (patch)
treed43b31d4c802179e6588987ef6add594f2e40239 /sql
parent6795b2642b155e64e73aa7571f30b84b090c3636 (diff)
downloadmariadb-git-be4e254b132987a41ec034217e9fde2c15cfc0d7.tar.gz
correct table name assigned to temporary table field:
- correct table name shown in EXPLAIN Iindex reference) - pointer on freed memmory (reallocation of table name in reusing table entry) can't be used in EXPLAIN (BUG#1584) mysql-test/r/derived.result: test moved to derived table tests added test of BUG#1584 mysql-test/r/subselect.result: test moved to derived table tests mysql-test/t/derived.test: test moved to derived table tests added test of BUG#1584 mysql-test/t/subselect.test: test moved to derived table tests sql/item.cc: layout fix sql/sql_select.cc: correct table name assigned to temporary table field
Diffstat (limited to 'sql')
-rw-r--r--sql/item.cc12
-rw-r--r--sql/sql_select.cc3
2 files changed, 10 insertions, 5 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 4de4951cb51..6fbc3a304d6 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -272,11 +272,13 @@ Item_field::Item_field(Field *f) :Item_ident(NullS,f->table_name,f->field_name)
}
// Constructor need to process subselect with temporary tables (see Item)
-Item_field::Item_field(THD *thd, Item_field &item):
- Item_ident(thd, item),
- field(item.field),
- result_field(item.result_field)
-{ collation.set(DERIVATION_IMPLICIT); }
+Item_field::Item_field(THD *thd, Item_field &item)
+ :Item_ident(thd, item),
+ field(item.field),
+ result_field(item.result_field)
+{
+ collation.set(DERIVATION_IMPLICIT);
+}
void Item_field::set_field(Field *field_par)
{
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 89aae95c951..9bdb989b6a1 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -4866,6 +4866,9 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
recinfo->type=FIELD_NORMAL;
if (!--hidden_field_count)
null_count=(null_count+7) & ~7; // move to next byte
+
+ // fix table name in field entry
+ field->table_name= table->table_name;
}
param->copy_field_end=copy;