Commit 9796f9c9 authored by unknown's avatar unknown
Browse files

MySQL Bugs: #16466: DD: SHOW CREATE TABLE does not show TABLESPACE table_space1 STORAGE DISK

parent 55c304a1
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -21,6 +21,14 @@ CREATE TABLE t1
(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
TABLESPACE ts1 STORAGE DISK
ENGINE=NDB;
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `pk1` int(11) NOT NULL,
  `b` int(11) NOT NULL,
  `c` int(11) NOT NULL,
  PRIMARY KEY  (`pk1`)
) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () 
INSERT INTO t1 VALUES (0, 0, 0);
SELECT * FROM t1;
pk1	b	c
+2 −0
Original line number Diff line number Diff line
@@ -54,6 +54,8 @@ CREATE TABLE t1
TABLESPACE ts1 STORAGE DISK
ENGINE=NDB;

SHOW CREATE TABLE t1;

INSERT INTO t1 VALUES (0, 0, 0);
SELECT * FROM t1;

+28 −15
Original line number Diff line number Diff line
@@ -8905,28 +8905,41 @@ ha_ndbcluster::generate_scan_filter(Ndb_cond_stack *ndb_cond_stack,
/*
  get table space info for SHOW CREATE TABLE
*/
char* ha_ndbcluster::get_tablespace_create_info()
char* ha_ndbcluster::get_tablespace_name()
{
  const char tablespace_key[]= " TABLESPACE ";
  const char storage_key[]= " STORAGE DISK";
  char*	str= 0;

  Ndb *ndb= get_ndb();
  NDBDICT *ndbdict= ndb->getDictionary();
  NdbError ndberr;
  Uint32 id;
  ndb->setDatabaseName(m_dbname);
  const NDBTAB *ndbtab= ndbdict->getTable(m_tabname);
  if (ndbtab == 0)
  {
    ndberr= ndbdict->getNdbError();
    goto err;
  }
  if (!ndbtab->getTablespace(&id))
  {
    ndberr= ndbdict->getNdbError();
    goto err;
  }
  {
    NdbDictionary::Tablespace ts= ndbdict->getTablespace(id);
    ndberr= ndbdict->getNdbError();
    if(ndberr.classification != ndberror_cl_none)
      goto err;
    return (my_strdup(ts.getName(), MYF(0)));
  }
err:
  if (ndberr.status == NdbError::TemporaryError)
    push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
			ER_GET_TEMPORARY_ERRMSG, ER(ER_GET_TEMPORARY_ERRMSG),
			ndberr.code, ndberr.message, "NDB");
  else
    push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
			ER_GET_ERRMSG, ER(ER_GET_ERRMSG),
			ndberr.code, ndberr.message, "NDB");
  return 0;

  // TODO retrieve table space name if there is one
  return 0;

  const char *tablespace_name= "<name>";

  uint len= sizeof(tablespace_key) + strlen(tablespace_name) + sizeof(storage_key);
  str= my_malloc(len, MYF(0));
  strxnmov(str, len, tablespace_key, tablespace_name, storage_key, NullS);
  return(str);
}

/*
+1 −1
Original line number Diff line number Diff line
@@ -701,7 +701,7 @@ static void set_tabname(const char *pathname, char *tabname);
  uint set_up_partition_info(partition_info *part_info,
                             TABLE *table,
                             void *tab);
  char* get_tablespace_create_info();
  char* get_tablespace_name();
  int set_range_data(void *tab, partition_info* part_info);
  int set_list_data(void *tab, partition_info* part_info);
  int complemented_pk_read(const byte *old_data, byte *new_data,
+2 −2
Original line number Diff line number Diff line
@@ -1713,8 +1713,8 @@ class handler :public Sql_alloc
  { return FALSE; }
  virtual char* get_foreign_key_create_info()
  { return(NULL);}  /* gets foreign key create string from InnoDB */
  virtual char* get_tablespace_create_info()
  { return(NULL);}  /* gets tablespace create string from handler */
  virtual char* get_tablespace_name()
  { return(NULL);}  /* gets tablespace name from handler */
  /* used in ALTER TABLE; 1 if changing storage engine is allowed */
  virtual bool can_switch_engines() { return 1; }
  /* used in REPLACE; is > 0 if table is referred by a FOREIGN KEY */
Loading