diff --git a/ndb/examples/ndbapi_async_example/ndbapi_async.cpp b/ndb/examples/ndbapi_async_example/ndbapi_async.cpp
index c34d8de9ec58bbf7fb41dae826c465596098bd6e..76ce1a8efe3a6e899756b8af33da536a684d407c 100644
--- a/ndb/examples/ndbapi_async_example/ndbapi_async.cpp
+++ b/ndb/examples/ndbapi_async_example/ndbapi_async.cpp
@@ -46,9 +46,9 @@
  *
  *  NdbDictionary::Column
  *       setName()
- *       setPrimaryKey()
  *       setType()
  *       setLength()
+ *       setPrimaryKey()
  *       setNullable()
  *
  *  NdbDictionary::Table
@@ -234,9 +234,9 @@ int create_table(Ndb * myNdb)
  * Column REG_NO
  */
   myColumn.setName("REG_NO");
-  myColumn.setPrimaryKey(true);
   myColumn.setType(NdbDictionary::Column::Unsigned);
   myColumn.setLength(1);
+  myColumn.setPrimaryKey(true);
   myColumn.setNullable(false);
   myTable.addColumn(myColumn);
 
@@ -244,9 +244,9 @@ int create_table(Ndb * myNdb)
  * Column BRAND
  */
   myColumn.setName("BRAND");
-  myColumn.setPrimaryKey(false);
   myColumn.setType(NdbDictionary::Column::Char);
   myColumn.setLength(20);
+  myColumn.setPrimaryKey(false);
   myColumn.setNullable(false);
   myTable.addColumn(myColumn);
 
@@ -254,9 +254,9 @@ int create_table(Ndb * myNdb)
  * Column COLOR
  */
   myColumn.setName("COLOR");
-  myColumn.setPrimaryKey(false);
   myColumn.setType(NdbDictionary::Column::Char);
   myColumn.setLength(20);
+  myColumn.setPrimaryKey(false);
   myColumn.setNullable(false);
   myTable.addColumn(myColumn);
 
@@ -494,5 +494,3 @@ int main()
   std::cout << "Number of temporary errors: " << tempErrors << std::endl;
   delete myNdb; 
 }
-
-
diff --git a/ndb/examples/ndbapi_example1/ndbapi_example1.cpp b/ndb/examples/ndbapi_example1/ndbapi_example1.cpp
index 53d23dd71337f497e96a2a334a0317eeffb72dda..03a84aa249bf4c105cc4dbd947f356ea81f30a4f 100644
--- a/ndb/examples/ndbapi_example1/ndbapi_example1.cpp
+++ b/ndb/examples/ndbapi_example1/ndbapi_example1.cpp
@@ -79,16 +79,16 @@ int main()
   myTable.setName("MYTABLENAME");
   
   myColumn.setName("ATTR1");
-  myColumn.setPrimaryKey(true);
   myColumn.setType(NdbDictionary::Column::Unsigned);
   myColumn.setLength(1);
+  myColumn.setPrimaryKey(true);
   myColumn.setNullable(false);
   myTable.addColumn(myColumn);
 
   myColumn.setName("ATTR2");
-  myColumn.setPrimaryKey(false);
   myColumn.setType(NdbDictionary::Column::Unsigned);
   myColumn.setLength(1);
+  myColumn.setPrimaryKey(false);
   myColumn.setNullable(false);
   myTable.addColumn(myColumn);
 
diff --git a/ndb/examples/ndbapi_example4/ndbapi_example4.cpp b/ndb/examples/ndbapi_example4/ndbapi_example4.cpp
index a37822dbf0cf75e83a02aef93e652487a4c2f7b9..fcb770d49e99e3f6fbd94376dc585a69fec3fdb8 100644
--- a/ndb/examples/ndbapi_example4/ndbapi_example4.cpp
+++ b/ndb/examples/ndbapi_example4/ndbapi_example4.cpp
@@ -80,16 +80,16 @@ int main()
   myTable.setName("MYTABLENAME");
   
   myColumn.setName("ATTR1");
-  myColumn.setPrimaryKey(true);
   myColumn.setType(NdbDictionary::Column::Unsigned);
   myColumn.setLength(1);
+  myColumn.setPrimaryKey(true);
   myColumn.setNullable(false);
   myTable.addColumn(myColumn);
 
   myColumn.setName("ATTR2");
-  myColumn.setPrimaryKey(false);
   myColumn.setType(NdbDictionary::Column::Unsigned);
   myColumn.setLength(1);
+  myColumn.setPrimaryKey(false);
   myColumn.setNullable(false);
   myTable.addColumn(myColumn);
 
diff --git a/ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp b/ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp
index 98cfd1ef0d5b1af6835289bb82e5333f5697d6fd..22641bc5b57d296598c8938cd2b66fbc9069a814 100644
--- a/ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp
+++ b/ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp
@@ -47,9 +47,9 @@
  *
  *  NdbDictionary::Column
  *       setName()
- *       setPrimaryKey()
  *       setType()
  *       setLength()
+ *       setPrimaryKey()
  *       setNullable()
  *
  *  NdbDictionary::Table
@@ -165,24 +165,24 @@ int create_table(Ndb * myNdb)
   myTable.setName("GARAGE");
   
   myColumn.setName("REG_NO");
-  myColumn.setPrimaryKey(true);
   myColumn.setType(NdbDictionary::Column::Unsigned);
   myColumn.setLength(1);
+  myColumn.setPrimaryKey(true);
   myColumn.setNullable(false);
   myTable.addColumn(myColumn);
 
   myColumn.setName("BRAND");
-  myColumn.setPrimaryKey(false);
   myColumn.setType(NdbDictionary::Column::Char);
   myColumn.setLength(20);
+  myColumn.setPrimaryKey(false);
   myColumn.setNullable(false);
   myTable.addColumn(myColumn);
 
 
   myColumn.setName("COLOR");
-  myColumn.setPrimaryKey(false);
   myColumn.setType(NdbDictionary::Column::Char);
   myColumn.setLength(20);
+  myColumn.setPrimaryKey(false);
   myColumn.setNullable(false);
   myTable.addColumn(myColumn);
 
@@ -814,4 +814,3 @@ int main()
 
   delete myNdb; 
 }
-
diff --git a/ndb/include/ndbapi/NdbDictionary.hpp b/ndb/include/ndbapi/NdbDictionary.hpp
index 5c470c1d25fa52671ca1d4b224cfa80ea63a04a2..3257133bd822721074b2775a02d49c2aa7cd6844 100644
--- a/ndb/include/ndbapi/NdbDictionary.hpp
+++ b/ndb/include/ndbapi/NdbDictionary.hpp
@@ -257,6 +257,10 @@ public:
     /**
      * Set type of column
      * @param  type  Type of column
+     *
+     * @note setType resets <em>all</em> column attributes
+     *       to (type dependent) defaults and should be the first
+     *       method to call.  Default type is Unsigned.
      */
     void setType(Type type);
 
@@ -306,23 +310,23 @@ public:
      * to store in table's blob attribute.  This part is normally in
      * main memory and can be indexed and interpreted.
      */
-    void setInlineSize(int size) { setPrecision(size); }
-    int getInlineSize() const { return getPrecision(); }
+    void setInlineSize(int size);
+    int getInlineSize() const;
 
     /**
      * For blob, set or get "part size" i.e. number of bytes to store in
      * each tuple of the "blob table".  Can be set to zero to omit parts
      * and to allow only inline bytes ("tinyblob").
      */
-    void setPartSize(int size) { setScale(size); }
-    int getPartSize() const { return getScale(); }
+    void setPartSize(int size);
+    int getPartSize() const;
 
     /**
      * For blob, set or get "stripe size" i.e. number of consecutive
      * <em>parts</em> to store in each node group.
      */
-    void setStripeSize(int size) { setLength(size); }
-    int getStripeSize() const { return getLength(); }
+    void setStripeSize(int size);
+    int getStripeSize() const;
 
     /**
      * Get size of element
diff --git a/ndb/src/ndbapi/NdbDictionary.cpp b/ndb/src/ndbapi/NdbDictionary.cpp
index 8000b53d3be9276d3c47adae18aaf15391b79c81..add1fa4cc91d15c6236ad9fc7fab4fcc02dc6e13 100644
--- a/ndb/src/ndbapi/NdbDictionary.cpp
+++ b/ndb/src/ndbapi/NdbDictionary.cpp
@@ -65,7 +65,7 @@ NdbDictionary::Column::getName() const {
 
 void
 NdbDictionary::Column::setType(Type t){
-  m_impl.m_type = t;
+  m_impl.init(t);
 }
 
 NdbDictionary::Column::Type 
@@ -103,6 +103,42 @@ NdbDictionary::Column::getLength() const{
   return m_impl.m_length;
 }
 
+void
+NdbDictionary::Column::setInlineSize(int size)
+{
+  m_impl.m_precision = size;
+}
+
+int
+NdbDictionary::Column::getInlineSize() const
+{
+  return m_impl.m_precision;
+}
+
+void
+NdbDictionary::Column::setPartSize(int size)
+{
+  m_impl.m_scale = size;
+}
+
+int
+NdbDictionary::Column::getPartSize() const
+{
+  return m_impl.m_scale;
+}
+
+void
+NdbDictionary::Column::setStripeSize(int size)
+{
+  m_impl.m_length = size;
+}
+
+int
+NdbDictionary::Column::getStripeSize() const
+{
+  return m_impl.m_length;
+}
+
 int 
 NdbDictionary::Column::getSize() const{
   return m_impl.m_attrSize;
diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
index 78a363c1a5f127a0352e0885a96d8264390a608f..64f349be53e3799bc7e064ebc0c7965466818d1c 100644
--- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp
+++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
@@ -87,10 +87,57 @@ NdbColumnImpl::operator=(const NdbColumnImpl& col)
 }
 
 void
-NdbColumnImpl::init()
+NdbColumnImpl::init(Type t)
 {
   m_attrId = -1;
-  m_type = NdbDictionary::Column::Unsigned;
+  m_type = t;
+  switch (m_type) {
+  case Tinyint:
+  case Tinyunsigned:
+  case Smallint:
+  case Smallunsigned:
+  case Mediumint:
+  case Mediumunsigned:
+  case Int:
+  case Unsigned:
+  case Bigint:
+  case Bigunsigned:
+  case Float:
+  case Double:
+    m_precision = 0;
+    m_scale = 0;
+    m_length = 1;
+    break;
+  case Decimal:
+    m_precision = 10;
+    m_scale = 0;
+    m_length = 1;
+    break;
+  case Char:
+  case Varchar:
+    m_precision = 0;
+    m_scale = 0;
+    m_length = 1;
+    break;
+  case Binary:
+  case Varbinary:
+  case Datetime:
+  case Timespec:
+    m_precision = 0;
+    m_scale = 0;
+    m_length = 1;
+    break;
+  case Blob:
+    m_precision = 256;
+    m_scale = 8000;
+    m_length = 4;
+    break;
+  case Text:
+    m_precision = 256;
+    m_scale = 8000;
+    m_length = 4;
+    break;
+  }
   m_pk = false;
   m_nullable = false;
   m_tupleKey = false;
@@ -98,12 +145,10 @@ NdbColumnImpl::init()
   m_distributionKey = false;
   m_distributionGroup = false;
   m_distributionGroupBits = 8;
-  m_length = 1;
-  m_scale = 5;
-  m_precision = 5;
   m_keyInfoPos = 0;
-  m_attrSize = 4,
-  m_arraySize = 1,
+  // next 2 are set at run time
+  m_attrSize = 0;
+  m_arraySize = 0;
   m_autoIncrement = false;
   m_autoIncrementInitialValue = 1;
   m_blobTable = NULL;
@@ -209,14 +254,18 @@ NdbColumnImpl::create_psuedo(const char * name){
   if(!strcmp(name, "NDB$FRAGMENT")){
     col->setType(NdbDictionary::Column::Unsigned);
     col->m_impl.m_attrId = AttributeHeader::FRAGMENT;
+    col->m_impl.m_attrSize = 4;
+    col->m_impl.m_arraySize = 1;
   } else if(!strcmp(name, "NDB$ROW_COUNT")){
     col->setType(NdbDictionary::Column::Bigunsigned);
     col->m_impl.m_attrId = AttributeHeader::ROW_COUNT;
     col->m_impl.m_attrSize = 8;
+    col->m_impl.m_arraySize = 1;
   } else if(!strcmp(name, "NDB$COMMIT_COUNT")){
     col->setType(NdbDictionary::Column::Bigunsigned);
     col->m_impl.m_attrId = AttributeHeader::COMMIT_COUNT;
     col->m_impl.m_attrSize = 8;
+    col->m_impl.m_arraySize = 1;
   } else {
     abort();
   }
diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.hpp b/ndb/src/ndbapi/NdbDictionaryImpl.hpp
index da5e7e45c3696806b49cd518229aef9616fdc471..d77cc4d44bc49f82d025a41cfa3f0098061d118f 100644
--- a/ndb/src/ndbapi/NdbDictionaryImpl.hpp
+++ b/ndb/src/ndbapi/NdbDictionaryImpl.hpp
@@ -52,7 +52,7 @@ public:
   NdbColumnImpl(NdbDictionary::Column &); // This is not a copy constructor
   ~NdbColumnImpl();
   NdbColumnImpl& operator=(const NdbColumnImpl&);
-  void init();
+  void init(Type t = Unsigned);
   
   int m_attrId;
   BaseString m_name;
diff --git a/ndb/test/include/NDBT_Table.hpp b/ndb/test/include/NDBT_Table.hpp
index 59db3ed1092f61d165e8b5675feeead7b7e5657f..d2f99b851871d901951814c8d1703d7cb413f880 100644
--- a/ndb/test/include/NDBT_Table.hpp
+++ b/ndb/test/include/NDBT_Table.hpp
@@ -33,10 +33,10 @@ public:
   {
     assert(_name != 0);
     
+    setType(_type);
+    setLength(_length);
     setNullable(_nullable);
     setPrimaryKey(_pk);
-    setLength(_length);
-    setType(_type);
   }
 };
 
diff --git a/ndb/test/ndbapi/index.cpp b/ndb/test/ndbapi/index.cpp
index ed34fc19f438c96d6694f8bd6f5e4b9ea6d5508c..c22da59416433b645b92c5cf72019a4870f71178 100644
--- a/ndb/test/ndbapi/index.cpp
+++ b/ndb/test/ndbapi/index.cpp
@@ -81,63 +81,63 @@ static void createTable(Ndb &myNdb, bool storeInACC, bool twoKey, bool longKey)
   int res;
 
   column.setName("NAME");
-  column.setPrimaryKey(true);
   column.setType(NdbDictionary::Column::Char);
   column.setLength((longKey)?
 		   1024       // 1KB => long key
 		   :12);
+  column.setPrimaryKey(true);
   column.setNullable(false);
   table.addColumn(column);
 
   if (twoKey) {
     column.setName("KEY2");
-    column.setPrimaryKey(true);
     column.setType(NdbDictionary::Column::Unsigned);
     column.setLength(1);
+    column.setPrimaryKey(true);
     column.setNullable(false);
     table.addColumn(column);
   }
 
   column.setName("PNUM1");
-  column.setPrimaryKey(false);
   column.setType(NdbDictionary::Column::Unsigned);
   column.setLength(1);
+  column.setPrimaryKey(false);
   column.setNullable(false);
   table.addColumn(column);
 
   column.setName("PNUM2");
-  column.setPrimaryKey(false);
   column.setType(NdbDictionary::Column::Unsigned);
   column.setLength(1);
+  column.setPrimaryKey(false);
   column.setNullable(false);
   table.addColumn(column);
 
   column.setName("PNUM3");
-  column.setPrimaryKey(false);
   column.setType(NdbDictionary::Column::Unsigned);
   column.setLength(1);
+  column.setPrimaryKey(false);
   column.setNullable(false);
   table.addColumn(column);
 
   column.setName("PNUM4");
-  column.setPrimaryKey(false);
   column.setType(NdbDictionary::Column::Unsigned);
   column.setLength(1);
+  column.setPrimaryKey(false);
   column.setNullable(false);
   table.addColumn(column);
 
   column.setName("AGE");
-  column.setPrimaryKey(false);
   column.setType(NdbDictionary::Column::Unsigned);
   column.setLength(1);
+  column.setPrimaryKey(false);
   column.setNullable(false);
   table.addColumn(column);
 
   column.setName("STRING_AGE");
-  column.setPrimaryKey(false);
   column.setType(NdbDictionary::Column::Char);
   column.setLength(1);
   column.setLength(256);
+  column.setPrimaryKey(false);
   column.setNullable(false);
   table.addColumn(column);
 
diff --git a/ndb/test/ndbapi/index2.cpp b/ndb/test/ndbapi/index2.cpp
index fb2275605d8555b52ab967668cf6098343173aec..f739468d7df10a18137de66031c1a725cf00127a 100644
--- a/ndb/test/ndbapi/index2.cpp
+++ b/ndb/test/ndbapi/index2.cpp
@@ -81,16 +81,16 @@ static void createTable(Ndb &myNdb, bool storeInACC, bool twoKey, bool longKey)
   int res;
 
   column.setName("X");
-  column.setPrimaryKey(true);
   column.setType(NdbDictionary::Column::Unsigned);
   column.setLength(1);
+  column.setPrimaryKey(true);
   column.setNullable(false);
   table.addColumn(column);
 
   column.setName("Y");
-  column.setPrimaryKey(false);
   column.setType(NdbDictionary::Column::Unsigned);
   column.setLength(1);
+  column.setPrimaryKey(false);
   column.setNullable(false);
   table.addColumn(column);
 
diff --git a/ndb/test/ndbapi/testDict.cpp b/ndb/test/ndbapi/testDict.cpp
index f4dd266414b2315a1008b3c4b696de0f7a282271..7cba5ce4cc85c858ee47bbd1190648fc05735b8b 100644
--- a/ndb/test/ndbapi/testDict.cpp
+++ b/ndb/test/ndbapi/testDict.cpp
@@ -1128,9 +1128,9 @@ runCreateAutoincrementTable(NDBT_Context* ctx, NDBT_Step* step){
     myTable.setName(tabname);
 
     myColumn.setName("ATTR1");
-    myColumn.setPrimaryKey(true);
     myColumn.setType(NdbDictionary::Column::Unsigned);
     myColumn.setLength(1);
+    myColumn.setPrimaryKey(true);
     myColumn.setNullable(false);
     myColumn.setAutoIncrement(true);
     if (startvalue != ~0) // check that default value starts with 1
diff --git a/ndb/test/ndbapi/testOIBasic.cpp b/ndb/test/ndbapi/testOIBasic.cpp
index 1bb8b251d01ec60191424bfd8b6185637877937d..ac28b96af80e074828f129bcf150bd314ccdd901 100644
--- a/ndb/test/ndbapi/testOIBasic.cpp
+++ b/ndb/test/ndbapi/testOIBasic.cpp
@@ -979,9 +979,9 @@ createtable(Par par)
   for (unsigned k = 0; k < tab.m_cols; k++) {
     const Col& col = tab.m_col[k];
     NdbDictionary::Column c(col.m_name);
-    c.setPrimaryKey(col.m_pk);
     c.setType(col.m_type);
     c.setLength(col.m_length);
+    c.setPrimaryKey(col.m_pk);
     c.setNullable(col.m_nullable);
     t.addColumn(c);
   }
@@ -2236,9 +2236,8 @@ pkreadfast(Par par, unsigned count)
     keyrow.calc(par, i);
     CHK(keyrow.selrow(par) == 0);
     NdbRecAttr* rec;
-    CHK(con.getValue((Uint32)0, rec) == 0);
-    CHK(con.executeScan() == 0);
     // get 1st column
+    CHK(con.getValue((Uint32)0, rec) == 0);
     CHK(con.execute(Commit) == 0);
     con.closeTransaction();
   }