diff options
author | evgen@moonbone.local <> | 2007-09-28 23:24:40 +0000 |
---|---|---|
committer | evgen@moonbone.local <> | 2007-09-28 23:24:40 +0000 |
commit | b9e81c2ae3f838194f181b8fb1b389dd42334211 (patch) | |
tree | 8eac86ce3439f35209aaa770d4d2cb7e11a96297 /sql/field.cc | |
parent | fca2a0c4acb8c92b0be667cc7a934d5abb10be4e (diff) | |
download | mariadb-git-b9e81c2ae3f838194f181b8fb1b389dd42334211.tar.gz |
Bug#27990: Wrong info in MYSQL_FIELD struct members when a tmp table was used.
The change_to_use_tmp_fields function leaves the orig_table member of an
expression's tmp table field filled for the new Item_field being created.
Later orig_table is used by the Field::make_field function to provide some
info about original table and field name to a user. This is ok for a field
but for an expression it should be empty.
The change_to_use_tmp_fields function now resets orig_table member of
an expression's tmp table field to prevent providing a wrong info to a user.
The Field::make_field function now resets the table_name and the org_col_name
variables when the orig_table is set to 0.
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/sql/field.cc b/sql/field.cc index 152c1bdc364..763448202ae 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1282,15 +1282,25 @@ void Field_num::add_zerofill_and_unsigned(String &res) const void Field::make_field(Send_field *field) { - if (orig_table->s->table_cache_key && *(orig_table->s->table_cache_key)) + if (orig_table && orig_table->s->table_cache_key && + *(orig_table->s->table_cache_key)) { field->org_table_name= orig_table->s->table_name; field->db_name= orig_table->s->table_cache_key; } else field->org_table_name= field->db_name= ""; - field->table_name= orig_table->alias; - field->col_name= field->org_col_name= field_name; + if (orig_table) + { + field->table_name= orig_table->alias; + field->org_col_name= field_name; + } + else + { + field->table_name= ""; + field->org_col_name= ""; + } + field->col_name= field_name; field->charsetnr= charset()->number; field->length=field_length; field->type=type(); |