diff options
author | unknown <monty@mysql.com> | 2004-03-26 14:44:52 +0200 |
---|---|---|
committer | unknown <monty@mysql.com> | 2004-03-26 14:44:52 +0200 |
commit | cc11f6f351e8056dabf47cf47f8a29aa3b6261a2 (patch) | |
tree | 5a81f759a80325c592c9d532356639e7dd272728 /myisam | |
parent | 922818a79809d789976e64a8b4faabd305863a7c (diff) | |
download | mariadb-git-cc11f6f351e8056dabf47cf47f8a29aa3b6261a2.tar.gz |
Allow keys with 0 segements in MyISAM
This fixed a bug in SELECT DISTINCT when all selected parts where constants. (Bug #3203)
myisam/mi_create.c:
Allow keys with 0 segements.
mysql-test/r/myisam.result:
Test for problem with SELECT DISTINCT
mysql-test/t/myisam.test:
Test for problem with SELECT DISTINCT
Diffstat (limited to 'myisam')
-rw-r--r-- | myisam/mi_create.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/myisam/mi_create.c b/myisam/mi_create.c index 9f39c6f522e..328450c70db 100644 --- a/myisam/mi_create.c +++ b/myisam/mi_create.c @@ -366,7 +366,13 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, my_errno=HA_WRONG_CREATE_OPTION; goto err; } - if ((keydef->flag & (HA_NOSAME | HA_NULL_PART_KEY)) == HA_NOSAME) + /* + key_segs may be 0 in the case when we only want to be able to + add on row into the table. This can happen with some DISTINCT queries + in MySQL + */ + if ((keydef->flag & (HA_NOSAME | HA_NULL_PART_KEY)) == HA_NOSAME && + key_segs) share.state.rec_per_key_part[key_segs-1]=1L; length+=key_length; keydef->block_length= MI_BLOCK_SIZE(length,pointer,MI_MAX_KEYPTR_SIZE); |