summaryrefslogtreecommitdiff
path: root/myisam/mi_create.c
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-03-29 19:21:53 +0300
committerunknown <monty@mysql.com>2004-03-29 19:21:53 +0300
commitff908d18a27247c3b4206ce49977c4a7c73792be (patch)
treef51ea3945f84d672edc962cdfc11eab16f569fc5 /myisam/mi_create.c
parent883215956e1597c7432cb79a68b510a4c0f7c9c2 (diff)
parent501c3e7a0e1770aa7b40a2b1c19b8e89388b834f (diff)
downloadmariadb-git-ff908d18a27247c3b4206ce49977c4a7c73792be.tar.gz
Merge with 4.0 to get lastest bug fixes
include/m_string.h: Auto merged myisam/mi_create.c: Auto merged mysql-test/r/bdb-crash.result: Auto merged sql/handler.h: Auto merged mysql-test/r/grant_cache.result: Auto merged mysql-test/t/grant_cache.test: Auto merged sql/sql_cache.cc: Auto merged sql/sql_table.cc: Auto merged innobase/mem/mem0dbg.c: Merge with 4.0 mysql-test/r/myisam.result: Merge with 4.0 mysql-test/r/order_by.result: Merge with 4.0 mysql-test/t/bdb-crash.test: Merge with 4.0 mysql-test/t/myisam.test: Merge with 4.0 mysql-test/t/order_by.test: Merge with 4.0 sql/ha_berkeley.cc: Merge with 4.0 (use local code) sql/sql_select.cc: Merge with 4.0 to get fix for FORCE INDEX ... ORDER BY
Diffstat (limited to 'myisam/mi_create.c')
-rw-r--r--myisam/mi_create.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/myisam/mi_create.c b/myisam/mi_create.c
index 72633966b54..5682862c39a 100644
--- a/myisam/mi_create.c
+++ b/myisam/mi_create.c
@@ -383,7 +383,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);