#At file:///home/marty/MySQL/mysql-5.1-telco-7.0/
4140 Martin Skold 2011-01-25 [merge]
Merge
modified:
mysql-test/suite/ndb/r/ndb_temporary.result
mysql-test/suite/ndb/t/ndb_temporary.test
sql/ha_ndbcluster.cc
sql/sql_table.cc
=== modified file 'mysql-test/suite/ndb/r/ndb_temporary.result'
--- a/mysql-test/suite/ndb/r/ndb_temporary.result 2007-08-02 22:14:05 +0000
+++ b/mysql-test/suite/ndb/r/ndb_temporary.result 2011-01-25 09:45:42 +0000
@@ -5,6 +5,10 @@ create temporary table t1 (a int key) en
alter table t1 engine=ndb;
ERROR HY000: Table storage engine 'ndbcluster' does not support the create option 'TEMPORARY'
drop table t1;
+CREATE TABLE bar ( id TINYINT NOT NULL AUTO_INCREMENT PRIMARY KEY ) ENGINE=NDBCluster ;
+CREATE TEMPORARY TABLE foo LIKE bar ;
+ERROR HY000: Can't create table 'test.foo' (errno: 1478)
+DROP TABLE bar;
SET SESSION storage_engine=NDBCLUSTER;
create table t1 (a int key);
select engine from information_schema.tables where table_name = 't1';
=== modified file 'mysql-test/suite/ndb/t/ndb_temporary.test'
--- a/mysql-test/suite/ndb/t/ndb_temporary.test 2007-11-29 10:29:35 +0000
+++ b/mysql-test/suite/ndb/t/ndb_temporary.test 2011-01-25 09:50:48 +0000
@@ -21,6 +21,14 @@ drop table t1;
#
+# create temporary like on an ndb table should give an error (bug#57437)
+#
+CREATE TABLE bar ( id TINYINT NOT NULL AUTO_INCREMENT PRIMARY KEY ) ENGINE=NDBCluster ;
+--error ER_CANT_CREATE_TABLE
+CREATE TEMPORARY TABLE foo LIKE bar ;
+DROP TABLE bar;
+
+#
# if default storage engine=ndb, temporary tables
# without explicit engine= should be created as myisam
#
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc 2011-01-24 10:08:02 +0000
+++ b/sql/ha_ndbcluster.cc 2011-01-25 13:49:47 +0000
@@ -7665,6 +7665,7 @@ int ha_ndbcluster::create(const char *na
size_t pack_length, length;
uint i, pk_length= 0;
uchar *data= NULL, *pack_data= NULL;
+ bool create_temporary= (create_info->options & HA_LEX_CREATE_TMP_TABLE);
bool create_from_engine= (create_info->table_options & HA_OPTION_CREATE_FROM_ENGINE);
bool is_truncate= (thd->lex->sql_command == SQLCOM_TRUNCATE);
const char *tablespace= create_info->tablespace;
@@ -7677,6 +7678,19 @@ int ha_ndbcluster::create(const char *na
DBUG_ENTER("ha_ndbcluster::create");
DBUG_PRINT("enter", ("name: %s", name));
+ if (create_temporary)
+ {
+ /*
+ Ndb does not support temporary tables
+ */
+ my_errno= ER_ILLEGAL_HA_CREATE_OPTION;
+ DBUG_PRINT("info", ("Ndb doesn't support temporary tables"));
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "Ndb doesn't support temporary tables");
+ DBUG_RETURN(my_errno);
+ }
+
DBUG_ASSERT(*fn_rext((char*)name) == 0);
set_dbname(name);
set_tabname(name);
=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc 2010-10-12 14:53:28 +0000
+++ b/sql/sql_table.cc 2011-01-25 10:07:17 +0000
@@ -5402,9 +5402,9 @@ bool mysql_create_like_table(THD* thd, T
err= ha_create_table(thd, dst_path, db, table_name, create_info, 1);
VOID(pthread_mutex_unlock(&LOCK_open));
- if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
+ if (!err && create_info->options & HA_LEX_CREATE_TMP_TABLE)
{
- if (err || !open_temporary_table(thd, dst_path, db, table_name, 1,
+ if (!open_temporary_table(thd, dst_path, db, table_name, 1,
OTM_OPEN))
{
(void) rm_temporary_table(create_info->db_type,
| Thread |
|---|
| • bzr commit into mysql-5.1-telco-7.0 branch (Martin.Skold:4140) Bug#57437 | Martin Skold | 25 Jan |