diff options
author | Luis Soares <luis.soares@sun.com> | 2010-06-03 00:08:35 +0100 |
---|---|---|
committer | Luis Soares <luis.soares@sun.com> | 2010-06-03 00:08:35 +0100 |
commit | d91dde90d39fe27beb00195868b250a111154479 (patch) | |
tree | 3f2ac933db627434c420a2a8677a541d5765a16d /sql/log_event_old.cc | |
parent | 5e24bb532e3a585937157539ca1d27e021665700 (diff) | |
parent | 0ade82fe03a31c78f4575e5e35020b11e5eea70d (diff) | |
download | mariadb-git-d91dde90d39fe27beb00195868b250a111154479.tar.gz |
BUG 53893: automerged from mysql-5.1-bugteam into mysql-trunk-merge.
Diffstat (limited to 'sql/log_event_old.cc')
-rw-r--r-- | sql/log_event_old.cc | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc index 76eda43aa48..59cc2005f56 100644 --- a/sql/log_event_old.cc +++ b/sql/log_event_old.cc @@ -2339,8 +2339,38 @@ int Old_rows_log_event::find_row(const Relay_log_info *rli) */ if (table->key_info->flags & HA_NOSAME) { - table->file->ha_index_end(); - DBUG_RETURN(0); + /* Unique does not have non nullable part */ + if (!(table->key_info->flags & (HA_NULL_PART_KEY))) + { + table->file->ha_index_end(); + DBUG_RETURN(0); + } + else + { + KEY *keyinfo= table->key_info; + /* + Unique has nullable part. We need to check if there is any field in the + BI image that is null and part of UNNI. + */ + bool null_found= FALSE; + + for (uint i=0, fieldnr= keyinfo->key_part[i].fieldnr - 1 ; + (i < keyinfo->key_parts) && !null_found ; + i++, fieldnr= keyinfo->key_part[i].fieldnr - 1) + { + Field **f= table->field+fieldnr; + if ((*f)->is_null()) + null_found= TRUE; + } + + if (!null_found) + { + table->file->ha_index_end(); + DBUG_RETURN(0); + } + + /* else fall through to index scan */ + } } /* |