From 3994b2150e3f130c586742f76958db425c8da5d1 Mon Sep 17 00:00:00 2001
From: "holyfoot@deer.(none)" <>
Date: Sat, 10 Dec 2005 18:02:36 +0400
Subject: [PATCH 1/9] Fix for bug #15225 (ANALYZE temporary has no effect)
---
mysql-test/r/analyze.result | 9 +++++++++
mysql-test/t/analyze.test | 9 +++++++++
sql/sql_table.cc | 13 +++++++++----
3 files changed, 27 insertions(+), 4 deletions(-)
diff --git a/mysql-test/r/analyze.result b/mysql-test/r/analyze.result
index 796b382f5d6..bded22c4859 100644
--- a/mysql-test/r/analyze.result
+++ b/mysql-test/r/analyze.result
@@ -37,3 +37,12 @@ Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_
execute stmt1;
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
deallocate prepare stmt1;
+create temporary table t1(a int, index(a));
+insert into t1 values('1'),('2'),('3'),('4'),('5');
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+show index from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 a 1 a A 5 NULL NULL YES BTREE
+drop table t1;
diff --git a/mysql-test/t/analyze.test b/mysql-test/t/analyze.test
index 5d653b65579..a4694c32d3c 100644
--- a/mysql-test/t/analyze.test
+++ b/mysql-test/t/analyze.test
@@ -48,4 +48,13 @@ execute stmt1;
execute stmt1;
deallocate prepare stmt1;
+#
+# bug#15225 (ANALYZE temporary has no effect)
+#
+create temporary table t1(a int, index(a));
+insert into t1 values('1'),('2'),('3'),('4'),('5');
+analyze table t1;
+show index from t1;
+drop table t1;
+
# End of 4.1 tests
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 294c59af90f..d582c36a4f4 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -2140,10 +2140,15 @@ send_result_message:
table->table->version=0; // Force close of table
else if (open_for_modify)
{
- pthread_mutex_lock(&LOCK_open);
- remove_table_from_cache(thd, table->table->table_cache_key,
- table->table->real_name, RTFC_NO_FLAG);
- pthread_mutex_unlock(&LOCK_open);
+ if (table->table->tmp_table)
+ table->table->file->info(HA_STATUS_CONST);
+ else
+ {
+ pthread_mutex_lock(&LOCK_open);
+ remove_table_from_cache(thd, table->table->table_cache_key,
+ table->table->real_name, RTFC_NO_FLAG);
+ pthread_mutex_unlock(&LOCK_open);
+ }
/* May be something modified consequently we have to invalidate cache */
query_cache_invalidate3(thd, table->table, 0);
}
From a9df79cf2c0e36036034d3e9f800be66b5080dee Mon Sep 17 00:00:00 2001
From: "holyfoot@vva.(none)" <>
Date: Wed, 5 Apr 2006 17:41:40 +0500
Subject: [PATCH 2/9] bug $17756 (sp_notembedded.test unstable)
---
mysql-test/r/sp_notembedded.result | 2 ++
mysql-test/t/sp_notembedded.test | 5 +++++
2 files changed, 7 insertions(+)
diff --git a/mysql-test/r/sp_notembedded.result b/mysql-test/r/sp_notembedded.result
index d434f5c32ce..1faf8834980 100644
--- a/mysql-test/r/sp_notembedded.result
+++ b/mysql-test/r/sp_notembedded.result
@@ -1,3 +1,4 @@
+drop table if exists t1,t3;
drop procedure if exists bug4902|
create procedure bug4902()
begin
@@ -204,3 +205,4 @@ drop procedure bug10100pv|
drop procedure bug10100pd|
drop procedure bug10100pc|
drop view v1|
+drop table t3;
diff --git a/mysql-test/t/sp_notembedded.test b/mysql-test/t/sp_notembedded.test
index 3854297ec0c..ead33ff9968 100644
--- a/mysql-test/t/sp_notembedded.test
+++ b/mysql-test/t/sp_notembedded.test
@@ -1,6 +1,10 @@
# Can't test with embedded server
-- source include/not_embedded.inc
+--sleep 2
+--disable_warnings
+drop table if exists t1,t3;
+--enable_warnings
delimiter |;
#
@@ -260,3 +264,4 @@ drop procedure bug10100pc|
drop view v1|
delimiter ;|
+drop table t3;
From be9f623012553b37bead7ab7ddb876f57418ddb5 Mon Sep 17 00:00:00 2001
From: "holyfoot@deer.(none)" <>
Date: Tue, 11 Apr 2006 15:01:21 +0500
Subject: [PATCH 3/9] bug #15442 (mysqltest.test doesn't work with the embedded
server)
---
mysql-test/mysql-test-run.pl | 1 +
mysql-test/mysql-test-run.sh | 1 +
mysql-test/t/mysqltest.test | 1 +
3 files changed, 3 insertions(+)
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 20bb6e0117a..3fcc5b554d8 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -678,6 +678,7 @@ sub command_line_setup () {
$glob_use_embedded_server= 1;
push(@glob_test_mode, "embedded");
$opt_skip_rpl= 1; # We never run replication with embedded
+ $opt_skip_ndbcluster= 1;
if ( $opt_extern )
{
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index c8d54d7e86c..e74a5ac82d0 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -279,6 +279,7 @@ while test $# -gt 0; do
USE_EMBEDDED_SERVER=1
USE_MANAGER=0 NO_SLAVE=1
USE_RUNNING_SERVER=""
+ USE_NDBCLUSTER=""
TEST_MODE="$TEST_MODE embedded" ;;
--purify)
USE_PURIFY=1
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
index f5c6a7617c5..a15a143e9f4 100644
--- a/mysql-test/t/mysqltest.test
+++ b/mysql-test/t/mysqltest.test
@@ -1,3 +1,4 @@
+-- source include/not_embedded.inc
# ============================================================================
#
From c2acfc5b7c7d5036db27d294e505260c6db331e8 Mon Sep 17 00:00:00 2001
From: "holyfoot@deer.(none)" <>
Date: Wed, 12 Apr 2006 22:05:23 +0500
Subject: [PATCH 4/9] bug #15860 (SPATIAL keys in INNODB)
---
mysql-test/r/innodb.result | 2 ++
mysql-test/t/innodb.test | 7 +++++++
sql/ha_myisam.cc | 2 +-
sql/handler.h | 1 +
sql/share/errmsg.txt | 2 ++
sql/sql_table.cc | 6 ++++++
6 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 9a190557211..1e6793c39db 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -3241,3 +3241,5 @@ where t2.a between t1.a - interval 2 day and t1.a + interval 2 day;
a a
2005-10-01 2005-10-01
drop table t1, t2;
+create table t1 (g geometry not null, spatial gk(g)) engine=innodb;
+ERROR HY000: The used table type doesn't support SPATIAL indexes
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index b0835cd8419..b95a6a25f28 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -2139,3 +2139,10 @@ insert into t2 values('2005-10-01');
select * from t1, t2
where t2.a between t1.a - interval 2 day and t1.a + interval 2 day;
drop table t1, t2;
+
+#
+# Bug #15680 (SPATIAL key in innodb)
+#
+--error 1461
+create table t1 (g geometry not null, spatial gk(g)) engine=innodb;
+
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index ff6431fa0f3..128cc191434 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -165,7 +165,7 @@ ha_myisam::ha_myisam(TABLE *table_arg)
int_table_flags(HA_NULL_IN_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER |
HA_DUPP_POS | HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY |
HA_FILE_BASED | HA_CAN_GEOMETRY | HA_READ_RND_SAME |
- HA_CAN_INSERT_DELAYED | HA_CAN_BIT_FIELD),
+ HA_CAN_INSERT_DELAYED | HA_CAN_BIT_FIELD | HA_CAN_RTREEKEYS),
can_enable_indexes(1)
{}
diff --git a/sql/handler.h b/sql/handler.h
index 977bd77a54e..056b11f2526 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -80,6 +80,7 @@
*/
#define HA_CAN_INSERT_DELAYED (1 << 14)
#define HA_PRIMARY_KEY_IN_READ_INDEX (1 << 15)
+#define HA_CAN_RTREEKEYS (1 << 17)
#define HA_NOT_DELETE_WITH_CACHE (1 << 18)
#define HA_NO_PREFIX_CHAR_KEYS (1 << 20)
#define HA_CAN_FULLTEXT (1 << 21)
diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt
index 37487c245a9..5de070faeb5 100644
--- a/sql/share/errmsg.txt
+++ b/sql/share/errmsg.txt
@@ -5611,3 +5611,5 @@ ER_TABLE_NEEDS_UPGRADE
eng "Table upgrade required. Please do \"REPAIR TABLE `%-.32s`\" to fix it!"
ER_SP_NO_AGGREGATE 42000
eng "AGGREGATE is not supported for stored functions"
+ER_TABLE_CANT_HANDLE_SPKEYS
+ eng "The used table type doesn't support SPATIAL indexes"
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index cb556acd5c7..f57fb4715d2 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1130,6 +1130,12 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
/* TODO: Add proper checks if handler supports key_type and algorithm */
if (key_info->flags & HA_SPATIAL)
{
+ if (!(file->table_flags() & HA_CAN_RTREEKEYS))
+ {
+ my_message(ER_TABLE_CANT_HANDLE_SPKEYS, ER(ER_TABLE_CANT_HANDLE_SPKEYS),
+ MYF(0));
+ DBUG_RETURN(-1);
+ }
if (key_info->key_parts != 1)
{
my_error(ER_WRONG_ARGUMENTS, MYF(0), "SPATIAL INDEX");
From a9996318f2df3b02e79d1e366f8f45ec69732b87 Mon Sep 17 00:00:00 2001
From: "holyfoot@vva.(none)" <>
Date: Mon, 24 Apr 2006 13:07:53 +0500
Subject: [PATCH 5/9] bug #16892 (mysql_client_test fails in embedded server)
---
mysql-test/t/mysql_client_test.test | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mysql-test/t/mysql_client_test.test b/mysql-test/t/mysql_client_test.test
index 66b57dd5fb7..1225bf73009 100644
--- a/mysql-test/t/mysql_client_test.test
+++ b/mysql-test/t/mysql_client_test.test
@@ -1,3 +1,6 @@
+# This test should work in embedded server after we fix mysqltest
+-- source include/not_embedded.inc
+
# We run with different binaries for normal and --embedded-server
#
# If this test fails with "command "$MYSQL_CLIENT_TEST" failed",
From 318aba9db1ddfac438c3f5232c7257253563adb4 Mon Sep 17 00:00:00 2001
From: "holyfoot@deer.(none)" <>
Date: Wed, 26 Apr 2006 15:58:27 +0500
Subject: [PATCH 6/9] bug #18455 (embedded server Win32 build)
---
VC++Files/libmysqld/libmysqld.dsp | 4 +++
VC++Files/libmysqld/libmysqld.vcproj | 36 ++++++++++++++++++++++++++
VC++Files/libmysqld/libmysqld_ia64.dsp | 4 +++
3 files changed, 44 insertions(+)
diff --git a/VC++Files/libmysqld/libmysqld.dsp b/VC++Files/libmysqld/libmysqld.dsp
index 87a88333a2a..8c1a5271656 100644
--- a/VC++Files/libmysqld/libmysqld.dsp
+++ b/VC++Files/libmysqld/libmysqld.dsp
@@ -363,6 +363,10 @@ SOURCE=..\mysys\my_getopt.c
SOURCE=..\sql-common\my_time.c
# End Source File
# Begin Source File
+
+SOURCE=..\sql-common\my_user.c
+# End Source File
+# Begin Source File
SOURCE=..\sql\net_serv.cpp
# End Source File
diff --git a/VC++Files/libmysqld/libmysqld.vcproj b/VC++Files/libmysqld/libmysqld.vcproj
index 47fb660bb7a..fe791d702a3 100644
--- a/VC++Files/libmysqld/libmysqld.vcproj
+++ b/VC++Files/libmysqld/libmysqld.vcproj
@@ -2009,6 +2009,42 @@
PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Date: Wed, 3 May 2006 17:43:32 +0500
Subject: [PATCH 7/9] merging fix
---
sql/sql_table.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index f6de9e34785..e9be44d7f24 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -2570,7 +2570,7 @@ send_result_message:
table->table->s->version=0; // Force close of table
else if (open_for_modify)
{
- if (table->table->tmp_table)
+ if (table->table->s->tmp_table)
table->table->file->info(HA_STATUS_CONST);
else
{
From 5b5db01a46acd8e97d1b207913e350511cd975c2 Mon Sep 17 00:00:00 2001
From: "holyfoot@deer.(none)" <>
Date: Wed, 3 May 2006 19:01:29 +0500
Subject: [PATCH 8/9] merging fix
---
mysql-test/t/innodb.test | 6 ------
mysql-test/t/sp_notembedded.test | 1 -
2 files changed, 7 deletions(-)
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index 703e3b311b9..e4c8bf89cca 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -2190,12 +2190,6 @@ SELECT DISTINCT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
drop table t2, t1;
-create table t2(a date, key(a)) engine=innodb;
-insert into t1 values('2005-10-01');
-insert into t2 values('2005-10-01');
-select * from t1, t2
- where t2.a between t1.a - interval 2 day and t1.a + interval 2 day;
-drop table t1, t2;
#
# Bug #15680 (SPATIAL key in innodb)
diff --git a/mysql-test/t/sp_notembedded.test b/mysql-test/t/sp_notembedded.test
index 893884b302f..0adbeb2d98b 100644
--- a/mysql-test/t/sp_notembedded.test
+++ b/mysql-test/t/sp_notembedded.test
@@ -265,4 +265,3 @@ drop view v1|
drop table t3|
delimiter ;|
-drop table t3;
From 2f154ab410f5bc4b9b274591109be8d8d440861c Mon Sep 17 00:00:00 2001
From: "holyfoot@deer.(none)" <>
Date: Thu, 4 May 2006 09:58:03 +0500
Subject: [PATCH 9/9] test result fixed
---
mysql-test/r/mysqltest.result | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result
index 990f04e5ba9..091a3c0547d 100644
--- a/mysql-test/r/mysqltest.result
+++ b/mysql-test/r/mysqltest.result
@@ -1,6 +1,6 @@
-select -1 as "before_use_test" ;
+select 0 as "before_use_test" ;
before_use_test
--1
+0
select otto from (select 1 as otto) as t1;
otto
1