diff options
author | joerg@mysql.com <> | 2006-06-30 19:37:11 +0200 |
---|---|---|
committer | joerg@mysql.com <> | 2006-06-30 19:37:11 +0200 |
commit | 34d5c36c2b458c837776d970a437d92300bba6ee (patch) | |
tree | 21956f92efb4ee2106848d7fa3c16c070f036b22 /sql | |
parent | af48a16ce33d7ddb2d766ec26c36a8156aa2aeaf (diff) | |
download | mariadb-git-34d5c36c2b458c837776d970a437d92300bba6ee.tar.gz |
Manual transfer of the following changeset into the 5.0.23 release clone:
1.2525 06/06/30 18:29:27 monty@mysql.com +3 -0
Reverted wrong bug fix (Bug#11228)
Diffstat (limited to 'sql')
-rw-r--r-- | sql/table.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sql/table.cc b/sql/table.cc index 9ec9463c33c..cfdb9bd93aa 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -678,6 +678,27 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, if (outparam->key_info[key].flags & HA_FULLTEXT) outparam->key_info[key].algorithm= HA_KEY_ALG_FULLTEXT; + if (primary_key >= MAX_KEY && (keyinfo->flags & HA_NOSAME)) + { + /* + If the UNIQUE key doesn't have NULL columns and is not a part key + declare this as a primary key. + */ + primary_key=key; + for (i=0 ; i < keyinfo->key_parts ;i++) + { + uint fieldnr= key_part[i].fieldnr; + if (!fieldnr || + outparam->field[fieldnr-1]->null_ptr || + outparam->field[fieldnr-1]->key_length() != + key_part[i].length) + { + primary_key=MAX_KEY; // Can't be used + break; + } + } + } + for (i=0 ; i < keyinfo->key_parts ; key_part++,i++) { if (new_field_pack_flag <= 1) |