summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorSergey Glukhov <Sergey.Glukhov@sun.com>2008-12-09 16:59:47 +0400
committerSergey Glukhov <Sergey.Glukhov@sun.com>2008-12-09 16:59:47 +0400
commitc5c64a30d44f720ff3c9a6bfcdbf11a0bcc70797 (patch)
tree239f6db5a55bfbf7247e5b4767a2a92dd7a8a338 /sql/sql_select.cc
parentd2b5e0bb940dbcf4dae0000a745cab58a351408e (diff)
downloadmariadb-git-c5c64a30d44f720ff3c9a6bfcdbf11a0bcc70797.tar.gz
Bug#31399 Wrong query result when doing join buffering over BIT fields
if table has bit fields then uneven bits(if exist) are stored into null bits place. So we need to copy null bits in case of uneven bit field presence.
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 2ac33c4e07f..b080fff8725 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -13233,6 +13233,7 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count)
length=0;
for (i=0 ; i < table_count ; i++)
{
+ bool have_bit_fields= FALSE;
uint null_fields=0,used_fields;
Field **f_ptr,*field;
@@ -13247,13 +13248,16 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count)
length+=field->fill_cache_field(copy);
if (copy->blob_field)
(*blob_ptr++)=copy;
- if (field->maybe_null())
+ if (field->real_maybe_null())
null_fields++;
+ if (field->type() == MYSQL_TYPE_BIT &&
+ ((Field_bit*)field)->bit_len)
+ have_bit_fields= TRUE;
copy++;
}
}
/* Copy null bits from table */
- if (null_fields && tables[i].table->s->null_fields)
+ if (null_fields || have_bit_fields)
{ /* must copy null bits */
copy->str=(char*) tables[i].table->null_flags;
copy->length= tables[i].table->s->null_bytes;