List:Commits« Previous MessageNext Message »
From:Martin Skold Date:April 20 2006 10:06am
Subject:bk commit into 5.0 tree (mskold:1.2151) BUG#19196
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of marty. When marty does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2151 06/04/20 12:06:22 mskold@stripped +6 -0
  Fix for bug#19196: Attempt to create index on usupported field type gives wrong error code

  ndb/src/ndbapi/NdbDictionaryImpl.cpp
    1.87 06/04/20 12:05:53 mskold@stripped +11 -7
    Fix for bug#19196: Attempt to create index on usupported field type gives wrong error code

  ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp
    1.18 06/04/20 12:05:53 mskold@stripped +3 -2
    Fix for bug#19196: Attempt to create index on usupported field type gives wrong error code

  ndb/src/common/util/NdbSqlUtil.cpp
    1.30 06/04/20 12:05:53 mskold@stripped +28 -24
    Fix for bug#19196: Attempt to create index on usupported field type gives wrong error code

  ndb/include/util/NdbSqlUtil.hpp
    1.24 06/04/20 12:05:53 mskold@stripped +3 -3
    Fix for bug#19196: Attempt to create index on usupported field type gives wrong error code

  mysql-test/r/ndb_bitfield.result
    1.6 06/04/20 12:05:53 mskold@stripped +2 -2
    Fix for bug#19196: Attempt to create index on usupported field type gives wrong error code

  ndb/include/kernel/signaldata/TupFrag.hpp
    1.8 06/04/20 12:04:28 mskold@stripped +2 -1
    Fix for bug#19196: Attempt to create index on usupported field type gives wrong error code

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	mskold
# Host:	blowfish.ndb.mysql.com
# Root:	/usr/local/home/marty/MySQL/mysql-5.0

--- 1.7/ndb/include/kernel/signaldata/TupFrag.hpp	2004-12-17 08:50:49 +01:00
+++ 1.8/ndb/include/kernel/signaldata/TupFrag.hpp	2006-04-20 12:04:28 +02:00
@@ -146,7 +146,8 @@
   enum ErrorCode {
     NoError = 0,
     InvalidCharset = 743,
-    TooManyBitsUsed = 831
+    TooManyBitsUsed = 831,
+    UnsupportedType = 906
   };
 private:
   Uint32 userPtr;

--- 1.23/ndb/include/util/NdbSqlUtil.hpp	2005-02-26 16:38:28 +01:00
+++ 1.24/ndb/include/util/NdbSqlUtil.hpp	2006-04-20 12:05:53 +02:00
@@ -117,9 +117,9 @@
   /**
    * Check character set.
    */
-  static bool usable_in_pk(Uint32 typeId, const void* info);
-  static bool usable_in_hash_index(Uint32 typeId, const void* info);
-  static bool usable_in_ordered_index(Uint32 typeId, const void* info);
+  static uint check_column_for_pk(Uint32 typeId, const void* info);
+  static uint check_column_for_hash_index(Uint32 typeId, const void* info);
+  static uint check_column_for_ordered_index(Uint32 typeId, const void* info);
 
   /**
    * Get number of length bytes and length from variable length string.

--- 1.29/ndb/src/common/util/NdbSqlUtil.cpp	2005-02-26 16:40:39 +01:00
+++ 1.30/ndb/src/common/util/NdbSqlUtil.cpp	2006-04-20 12:05:53 +02:00
@@ -872,8 +872,8 @@
 
 // check charset
 
-bool
-NdbSqlUtil::usable_in_pk(Uint32 typeId, const void* info)
+uint
+NdbSqlUtil::check_column_for_pk(Uint32 typeId, const void* info)
 {
   const Type& type = getType(typeId);
   switch (type.m_typeId) {
@@ -882,12 +882,14 @@
   case Type::Longvarchar:
     {
       const CHARSET_INFO *cs = (const CHARSET_INFO*)info;
-      return
-        cs != 0 &&
-        cs->cset != 0 &&
-        cs->coll != 0 &&
-        cs->coll->strnxfrm != 0 &&
-        cs->strxfrm_multiply <= MAX_XFRM_MULTIPLY;
+      if(cs != 0 &&
+         cs->cset != 0 &&
+         cs->coll != 0 &&
+         cs->coll->strnxfrm != 0 &&
+         cs->strxfrm_multiply <= MAX_XFRM_MULTIPLY)
+        return 0;
+      else
+        return 743;
     }
     break;
   case Type::Undefined:
@@ -896,19 +898,19 @@
   case Type::Bit:
     break;
   default:
-    return true;
+    return 0;
   }
-  return false;
+  return 906;
 }
 
-bool
-NdbSqlUtil::usable_in_hash_index(Uint32 typeId, const void* info)
+uint
+NdbSqlUtil::check_column_for_hash_index(Uint32 typeId, const void* info)
 {
-  return usable_in_pk(typeId, info);
+  return check_column_for_pk(typeId, info);
 }
 
-bool
-NdbSqlUtil::usable_in_ordered_index(Uint32 typeId, const void* info)
+uint
+NdbSqlUtil::check_column_for_ordered_index(Uint32 typeId, const void* info)
 {
   const Type& type = getType(typeId);
   if (type.m_cmp == NULL)
@@ -919,13 +921,15 @@
   case Type::Longvarchar:
     {
       const CHARSET_INFO *cs = (const CHARSET_INFO*)info;
-      return
-        cs != 0 &&
-        cs->cset != 0 &&
-        cs->coll != 0 &&
-        cs->coll->strnxfrm != 0 &&
-        cs->coll->strnncollsp != 0 &&
-        cs->strxfrm_multiply <= MAX_XFRM_MULTIPLY;
+      if (cs != 0 &&
+          cs->cset != 0 &&
+          cs->coll != 0 &&
+          cs->coll->strnxfrm != 0 &&
+          cs->coll->strnncollsp != 0 &&
+          cs->strxfrm_multiply <= MAX_XFRM_MULTIPLY)
+        return 0;
+      else
+        return 743;
     }
     break;
   case Type::Undefined:
@@ -934,9 +938,9 @@
   case Type::Bit:       // can be fixed
     break;
   default:
-    return true;
+    return 0;
   }
-  return false;
+  return 906;
 }
 
 // utilities

--- 1.17/ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp	2004-12-26 22:34:25 +01:00
+++ 1.18/ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp	2006-04-20 12:05:53 +02:00
@@ -217,11 +217,12 @@
       break;
     }
     if (descAttr.m_charset != 0) {
+      uint err;
       CHARSET_INFO *cs = all_charsets[descAttr.m_charset];
       ndbrequire(cs != 0);
-      if (! NdbSqlUtil::usable_in_ordered_index(descAttr.m_typeId, cs)) {
+      if ((err = NdbSqlUtil::check_column_for_ordered_index(descAttr.m_typeId, cs))) {
         jam();
-        errorCode = TuxAddAttrRef::InvalidCharset;
+        errorCode = (TuxAddAttrRef::ErrorCode) err;
         break;
       }
     }

--- 1.86/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2006-04-07 15:48:10 +02:00
+++ 1.87/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2006-04-20 12:05:53 +02:00
@@ -1573,7 +1573,7 @@
 				     bool alter)
 {
   DBUG_ENTER("NdbDictInterface::createOrAlterTable");
-  unsigned i;
+  unsigned i, err;
   if((unsigned)impl.getNoOfPrimaryKeys() > NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY){
     m_error.code= 4317;
     DBUG_RETURN(-1);
@@ -1683,8 +1683,10 @@
       DBUG_RETURN(-1);
     }
     // primary key type check
-    if (col->m_pk && ! NdbSqlUtil::usable_in_pk(col->m_type, col->m_cs)) {
-      m_error.code= (col->m_cs != 0 ? 743 : 739);
+    if (col->m_pk && 
+        (err = NdbSqlUtil::check_column_for_pk(col->m_type, col->m_cs)))
+    {
+      m_error.code= err;
       DBUG_RETURN(-1);
     }
     // distribution key not supported for Char attribute
@@ -2157,7 +2159,7 @@
 {
   //validate();
   //aggregate();
-  unsigned i;
+  unsigned i, err;
   UtilBufferWriter w(m_buffer);
   const size_t len = strlen(impl.m_externalName.c_str()) + 1;
   if(len > MAX_TAB_NAME_SIZE) {
@@ -2208,10 +2210,12 @@
 
     // index key type check
     if (it == DictTabInfo::UniqueHashIndex &&
-        ! NdbSqlUtil::usable_in_hash_index(col->m_type, col->m_cs) ||
+        (err = NdbSqlUtil::check_column_for_hash_index(col->m_type, col->m_cs))
+        ||
         it == DictTabInfo::OrderedIndex &&
-        ! NdbSqlUtil::usable_in_ordered_index(col->m_type, col->m_cs)) {
-      m_error.code = 743;
+        (err = NdbSqlUtil::check_column_for_ordered_index(col->m_type, col->m_cs)))
+    {
+      m_error.code = err;
       return -1;
     }
     attributeList.id[i] = col->m_attrId;

--- 1.5/mysql-test/r/ndb_bitfield.result	2006-01-02 14:38:35 +01:00
+++ 1.6/mysql-test/r/ndb_bitfield.result	2006-04-20 12:05:53 +02:00
@@ -201,13 +201,13 @@
 pk1 bit(9) not null primary key,
 b int
 ) engine=ndbcluster;
-ERROR HY000: Can't create table './test/t1.frm' (errno: 739)
+ERROR HY000: Can't create table './test/t1.frm' (errno: 906)
 create table t1 (
 pk1 int not null primary key,
 b bit(9),
 key(b)
 ) engine=ndbcluster;
-ERROR HY000: Can't create table './test/t1.frm' (errno: 743)
+ERROR HY000: Can't create table './test/t1.frm' (errno: 906)
 create table t1 (
 pk1 int primary key,
 b bit(32) not null
Thread
bk commit into 5.0 tree (mskold:1.2151) BUG#19196Martin Skold20 Apr