summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2011-06-24 18:42:14 -0700
committerIgor Babaev <igor@askmonty.org>2011-06-24 18:42:14 -0700
commit37bac085da110a42b1d7dc3ced5e555070cb8c36 (patch)
tree90b1c1a566bfb8513cefba5ad1552fa1cd6a84de /sql/table.cc
parentfb22eb1391957c151e14cb8f269fb8112f5252b1 (diff)
downloadmariadb-git-37bac085da110a42b1d7dc3ced5e555070cb8c36.tar.gz
Fixed LP bug #799499.
The following were missing in the patch for mwl106: - KEY_PART_INFO::fieldnr were not set for generated keys to access tmp tables storing the rows of materialized derived tables/views - TABLE_SHARE::column_bitmap_size was not set for tmp tables storing the rows of materialized derived tables/views. These could cause crashes or memory overwrite.
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/table.cc b/sql/table.cc
index 8427ca6e112..2d2311d8987 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -5241,13 +5241,14 @@ bool TABLE::alloc_keys(uint key_count)
void TABLE::create_key_part_by_field(KEY *keyinfo,
KEY_PART_INFO *key_part_info,
- Field *field)
+ Field *field, uint fieldnr)
{
field->flags|= PART_KEY_FLAG;
key_part_info->null_bit= field->null_bit;
key_part_info->null_offset= (uint) (field->null_ptr -
(uchar*) record[0]);
key_part_info->field= field;
+ key_part_info->fieldnr= fieldnr;
key_part_info->offset= field->offset(record[0]);
key_part_info->length= (uint16) field->pack_length();
keyinfo->key_length+= key_part_info->length;
@@ -5340,11 +5341,12 @@ bool TABLE::add_tmp_key(uint key, uint key_parts,
for (i= 0; i < key_parts; i++)
{
- reg_field= field + next_field_no(arg);
+ uint fld_idx= next_field_no(arg);
+ reg_field= field + fld_idx;
if (key_start)
(*reg_field)->key_start.set_bit(key);
(*reg_field)->part_of_key.set_bit(key);
- create_key_part_by_field(keyinfo, key_part_info, *reg_field);
+ create_key_part_by_field(keyinfo, key_part_info, *reg_field, fld_idx+1);
key_start= FALSE;
key_part_info++;
}