summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <reggie@mdk10.(none)>2005-06-10 14:17:32 -0500
committerunknown <reggie@mdk10.(none)>2005-06-10 14:17:32 -0500
commitdcbc9b197b3291272deb85e9d695a49133a913cf (patch)
tree0fcd1a91ddcb3e407d2a61ab1db49374f40529c4
parent7c60583ea6bb6af7cf8a334ac8dc6ab005505cdb (diff)
parent1600d67afe3369fdc43ab0ea94df444ce23d8a85 (diff)
downloadmariadb-git-dcbc9b197b3291272deb85e9d695a49133a913cf.tar.gz
Merge rburnett@bk-internal.mysql.com:/home/bk/mysql-4.1
into mdk10.(none):/home/reggie/bk/41test3
-rw-r--r--configure.in16
-rw-r--r--include/my_global.h6
-rw-r--r--mysql-test/Makefile.am3
-rw-r--r--mysql-test/r/create.result6
-rw-r--r--mysql-test/r/heap.result5
-rw-r--r--mysql-test/t/create.test11
-rw-r--r--mysql-test/t/heap.test9
-rw-r--r--mysys/hash.c22
-rw-r--r--sql/ha_heap.h1
-rw-r--r--sql/sql_table.cc15
10 files changed, 72 insertions, 22 deletions
diff --git a/configure.in b/configure.in
index e685e811c2f..d454d23b38c 100644
--- a/configure.in
+++ b/configure.in
@@ -501,33 +501,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* | *modesto*)
FIND_PROC=
diff --git a/include/my_global.h b/include/my_global.h
index 523ecfba74d..f8ba555b150 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -264,13 +264,7 @@ C_MODE_START int __cxa_pure_virtual() {\
# endif
#endif /* TIME_WITH_SYS_TIME */
#ifdef HAVE_UNISTD_H
-#if defined(HAVE_OPENSSL) && !defined(__FreeBSD__) && !defined(NeXT) && !defined(__OpenBSD__)
-#define crypt unistd_crypt
-#endif
#include <unistd.h>
-#ifdef HAVE_OPENSSL
-#undef crypt
-#endif
#endif
#if defined(__cplusplus) && defined(NO_CPLUSPLUS_ALLOCA)
#undef HAVE_ALLOCA
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index 75adc45d73a..0480c83296e 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -35,7 +35,8 @@ testdir = $(benchdir_root)/mysql-test
EXTRA_SCRIPTS = mysql-test-run.sh mysql-test-run.pl install_test_db.sh
EXTRA_DIST = $(EXTRA_SCRIPTS)
test_SCRIPTS = mysql-test-run install_test_db
-test_DATA = std_data/client-key.pem std_data/client-cert.pem std_data/cacert.pem
+test_DATA = std_data/client-key.pem std_data/client-cert.pem std_data/cacert.pem \
+ std_data/server-cert.pem std_data/server-key.pem
CLEANFILES = $(test_SCRIPTS) $(test_DATA)
INCLUDES = -I$(srcdir)/../include -I../include -I..
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index de3840447dc..4c4b388388a 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -580,3 +580,9 @@ ERROR 42000: Incorrect database name 'xyz'
create table t1(t1.name int);
create table t2(test.t2.name int);
drop table t1,t2;
+create database mysqltest;
+use mysqltest;
+drop database mysqltest;
+create table test.t1 like x;
+ERROR 42000: Incorrect database name 'NULL'
+drop table if exists test.t1;
diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result
index 29207a4ae98..53dec294ef8 100644
--- a/mysql-test/r/heap.result
+++ b/mysql-test/r/heap.result
@@ -291,3 +291,8 @@ a b
1 7
1 8
drop table t1;
+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/create.test b/mysql-test/t/create.test
index b73cd28c71c..ca3446b46fc 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -492,3 +492,14 @@ create table t1(t1.name int);
create table t2(test.t2.name int);
drop table t1,t2;
+#
+# Bug#11028: Crash on create table like
+#
+create database mysqltest;
+use mysqltest;
+drop database mysqltest;
+--error 1102
+create table test.t1 like x;
+--disable_warnings
+drop table if exists test.t1;
+--enable_warnings
diff --git a/mysql-test/t/heap.test b/mysql-test/t/heap.test
index e082993a58e..c0977819487 100644
--- a/mysql-test/t/heap.test
+++ b/mysql-test/t/heap.test
@@ -224,3 +224,12 @@ insert t1 (a) values (1);
insert t1 (a) values (1);
select * from t1;
drop table t1;
+
+#
+# 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 b829f19dfc8..ffebdf76144 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 60e2e84c5d2..33de0156074 100644
--- a/sql/ha_heap.h
+++ b/sql/ha_heap.h
@@ -53,6 +53,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; }
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 3aa6da7ad0c..e2e6ee23323 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -2298,26 +2298,31 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
char src_path[FN_REFLEN], dst_path[FN_REFLEN];
char *db= table->db;
char *table_name= table->real_name;
- char *src_db= thd->db;
+ char *src_db;
char *src_table= table_ident->table.str;
int err, res= -1;
TABLE_LIST src_tables_list;
DBUG_ENTER("mysql_create_like_table");
+ src_db= table_ident->db.str ? table_ident->db.str : thd->db;
/*
Validate the source table
*/
if (table_ident->table.length > NAME_LEN ||
(table_ident->table.length &&
- check_table_name(src_table,table_ident->table.length)) ||
- table_ident->db.str && check_db_name((src_db= table_ident->db.str)))
+ check_table_name(src_table,table_ident->table.length)))
{
my_error(ER_WRONG_TABLE_NAME, MYF(0), src_table);
DBUG_RETURN(-1);
}
+ if (!src_db || check_db_name(src_db))
+ {
+ my_error(ER_WRONG_DB_NAME, MYF(0), src_db ? src_db : "NULL");
+ DBUG_RETURN(-1);
+ }
- src_tables_list.db= table_ident->db.str ? table_ident->db.str : thd->db;
- src_tables_list.real_name= table_ident->table.str;
+ src_tables_list.db= src_db;
+ src_tables_list.real_name= src_table;
src_tables_list.next= 0;
if (lock_and_wait_for_table_name(thd, &src_tables_list))