summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.in16
-rw-r--r--mysql-test/r/heap.result5
-rw-r--r--mysql-test/t/heap.test9
-rw-r--r--mysys/hash.c22
-rw-r--r--sql/ha_heap.h1
5 files changed, 43 insertions, 10 deletions
diff --git a/configure.in b/configure.in
index f761c5535f6..08b739c5782 100644
--- a/configure.in
+++ b/configure.in
@@ -442,33 +442,33 @@ PS=$ac_cv_path_PS
# Linux style
if $PS p $$ 2> /dev/null | grep $0 > /dev/null
then
- FIND_PROC="$PS p \$\$PID | grep \$\$MYSQLD > /dev/null"
+ FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
# Solaris
elif $PS -fp $$ 2> /dev/null | grep $0 > /dev/null
then
- FIND_PROC="$PS -p \$\$PID | grep \$\$MYSQLD > /dev/null"
+ FIND_PROC="$PS -p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
# BSD style
elif $PS -uaxww 2> /dev/null | grep $0 > /dev/null
then
- FIND_PROC="$PS -uaxww | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
+ FIND_PROC="$PS -uaxww | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
# SysV style
elif $PS -ef 2> /dev/null | grep $0 > /dev/null
then
- FIND_PROC="$PS -ef | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
+ FIND_PROC="$PS -ef | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
# Do anybody use this?
elif $PS $$ 2> /dev/null | grep $0 > /dev/null
then
- FIND_PROC="$PS \$\$PID | grep \$\$MYSQLD > /dev/null"
+ FIND_PROC="$PS \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
else
case $SYSTEM_TYPE in
*freebsd*)
- FIND_PROC="$PS p \$\$PID | grep \$\$MYSQLD > /dev/null"
+ FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
;;
*darwin*)
- FIND_PROC="$PS -uaxww | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
+ FIND_PROC="$PS -uaxww | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
;;
*cygwin*)
- FIND_PROC="$PS -e | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
+ FIND_PROC="$PS -e | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
;;
*netware*)
FIND_PROC=
diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result
index d2750fd5a43..52bf99d45ea 100644
--- a/mysql-test/r/heap.result
+++ b/mysql-test/r/heap.result
@@ -696,3 +696,8 @@ drop table t1;
create table t1 (a int not null, b int not null auto_increment,
primary key(a, b)) engine=heap;
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
+create table t1 (c char(255), primary key(c(90)));
+insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
+insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
+ERROR 23000: Duplicate entry 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl' for key 1
+drop table t1;
diff --git a/mysql-test/t/heap.test b/mysql-test/t/heap.test
index 68a84e1c193..75ef5a73cb0 100644
--- a/mysql-test/t/heap.test
+++ b/mysql-test/t/heap.test
@@ -426,3 +426,12 @@ drop table t1;
--error 1075
create table t1 (a int not null, b int not null auto_increment,
primary key(a, b)) engine=heap;
+
+#
+# Bug #10566: Verify that we can create a prefixed key with length > 255
+#
+create table t1 (c char(255), primary key(c(90)));
+insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
+--error 1062
+insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
+drop table t1;
diff --git a/mysys/hash.c b/mysys/hash.c
index fe27b5fcb6d..28f8797288c 100644
--- a/mysys/hash.c
+++ b/mysys/hash.c
@@ -262,7 +262,25 @@ static void movelink(HASH_LINK *array,uint find,uint next_link,uint newlink)
return;
}
- /* Compare a key in a record to a whole key. Return 0 if identical */
+/*
+ Compare a key in a record to a whole key. Return 0 if identical
+
+ SYNOPSIS
+ hashcmp()
+ hash hash table
+ pos position of hash record to use in comparison
+ key key for comparison
+ length length of key
+
+ NOTES:
+ If length is 0, comparison is done using the length of the
+ record being compared against.
+
+ RETURN
+ < 0 key of record < key
+ = 0 key of record == key
+ > 0 key of record > key
+ */
static int hashcmp(HASH *hash,HASH_LINK *pos,const byte *key,uint length)
{
@@ -270,7 +288,7 @@ static int hashcmp(HASH *hash,HASH_LINK *pos,const byte *key,uint length)
byte *rec_key= (byte*) hash_key(hash,pos->data,&rec_keylength,1);
return ((length && length != rec_keylength) ||
my_strnncoll(hash->charset, (uchar*) rec_key, rec_keylength,
- (uchar*) key, length));
+ (uchar*) key, rec_keylength));
}
diff --git a/sql/ha_heap.h b/sql/ha_heap.h
index 5d50270ec5b..2aa065e0d96 100644
--- a/sql/ha_heap.h
+++ b/sql/ha_heap.h
@@ -57,6 +57,7 @@ public:
}
const key_map *keys_to_use_for_scanning() { return &btree_keys; }
uint max_supported_keys() const { return MAX_KEY; }
+ uint max_supported_key_part_length() const { return MAX_KEY_LENGTH; }
double scan_time() { return (double) (records+deleted) / 20.0+10; }
double read_time(uint index, uint ranges, ha_rows rows)
{ return (double) rows / 20.0+1; }