List:Commits« Previous MessageNext Message »
From:Martin Zaun Date:October 22 2010 5:47am
Subject:bzr commit into mysql-5.1-telco-6.3 branch (martin.zaun:3319)
View as plain text  
#At file:///Users/mz/mysql/ndb-6.3-wl5421/ based on revid:martin.zaun@stripped

 3319 Martin Zaun	2010-10-21 [merge]
      wl5421: mtr tests for ndb_restore with type demotion.

    added:
      mysql-test/suite/ndb/r/ndb_restore_lossy_charbinary_conv.result
      mysql-test/suite/ndb/r/ndb_restore_lossy_integral_conv.result
      mysql-test/suite/ndb/r/ndb_restore_padding_preservation.result
      mysql-test/suite/ndb/t/ndb_restore_lossy_charbinary_conv.test
      mysql-test/suite/ndb/t/ndb_restore_lossy_integral_conv.test
      mysql-test/suite/ndb/t/ndb_restore_padding_preservation.test
=== added file 'mysql-test/suite/ndb/r/ndb_restore_lossy_charbinary_conv.result'
--- a/mysql-test/suite/ndb/r/ndb_restore_lossy_charbinary_conv.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/r/ndb_restore_lossy_charbinary_conv.result	2010-10-22 05:47:04 +0000
@@ -0,0 +1,373 @@
+************************************************************
+* Creating table with char+binary types
+************************************************************
+CREATE TABLE t2(
+c1 char(2), c2 char(128), c3 char(255),
+b1 binary(2), b2 binary(128), b3 binary(255),
+vc1 varchar(2), vc2 varchar(255), vc3 varchar(1024),
+vb1 varbinary(2), vb2 varbinary(255), vb3 varbinary(1024)
+) ENGINE=NDB;
+INSERT INTO t2 VALUES(
+repeat('a', 2), repeat('b', 128), repeat('c', 255),
+repeat('d', 2), repeat('e', 128), repeat('f', 255),
+repeat('g', 2), repeat('h', 255), repeat('i', 1024),
+repeat('j', 2), repeat('k', 255), repeat('l', 1024)
+);
+************************************************************
+* Backing up table with char+binary types
+************************************************************
+************************************************************
+* Restoring table with unchanged char+binary types:
+*     char(2)            -->    char(2)
+*     char(128)          -->    char(128)
+*     char(255)          -->    char(255)
+*     binary(2)          -->    binary(2)
+*     binary(128)        -->    binary(128)
+*     binary(255)        -->    binary(255)
+*     varchar(2)         -->    varchar(2)
+*     varchar(255)       -->    varchar(255)
+*     varchar(1024)      -->    varchar(1024)
+*     varbinary(2)       -->    varbinary(2)
+*     varbinary(255)     -->    varbinary(255)
+*     varbinary(1024)    -->    varbinary(1024)
+************************************************************
+CREATE TABLE t2_myisam ENGINE=MYISAM AS SELECT * FROM t2;
+DELETE FROM t2;
+SELECT
+length(c1), length(c2), length(c3),
+length(b1), length(b2), length(b2),
+length(vc1), length(vc2), length(vc3),
+length(vb1), length(vb2), length(vb3)
+FROM t2;
+length(c1)	length(c2)	length(c3)	length(b1)	length(b2)	length(b2)	length(vc1)	length(vc2)	length(vc3)	length(vb1)	length(vb2)	length(vb3)
+2	128	255	2	128	128	2	255	1024	2	255	1024
+SELECT COUNT(*) FROM t2 NATURAL JOIN t2_myisam;
+COUNT(*)
+1
+DROP TABLE t2_myisam;
+************************************************************
+* Restoring table with 1st degree demoted char+binary types:
+*     char(2)            -->    char(1)
+*     char(128)          -->    char(2)
+*     char(255)          -->    char(128)
+*     binary(2)          -->    binary(1)
+*     binary(128)        -->    binary(2)
+*     binary(255)        -->    binary(128)
+*     varchar(2)         -->    varchar(1)
+*     varchar(255)       -->    varchar(2)
+*     varchar(1024)      -->    varchar(512)
+*     varbinary(2)       -->    varbinary(1)
+*     varbinary(255)     -->    varbinary(2)
+*     varbinary(1024)    -->    varbinary(512)
+************************************************************
+ALTER TABLE t2
+modify c1 char(1), modify c2 char(2), modify c3 char(128),
+modify b1 binary(1), modify b2 binary(2), modify b3 binary(128),
+modify vc1 varchar(1), modify vc2 varchar(2), modify vc3 varchar(512),
+modify vb1 varbinary(1), modify vb2 varbinary(2), modify vb3 varbinary(512);
+SELECT
+length(c1), length(c2), length(c3),
+length(b1), length(b2), length(b2),
+length(vc1), length(vc2), length(vc3),
+length(vb1), length(vb2), length(vb3)
+FROM t2;
+length(c1)	length(c2)	length(c3)	length(b1)	length(b2)	length(b2)	length(vc1)	length(vc2)	length(vc3)	length(vb1)	length(vb2)	length(vb3)
+1	2	128	1	2	2	1	2	512	1	2	512
+CREATE TABLE t2_myisam ENGINE=MYISAM AS SELECT * FROM t2;
+DELETE FROM t2;
+SELECT
+length(c1), length(c2), length(c3),
+length(b1), length(b2), length(b2),
+length(vc1), length(vc2), length(vc3),
+length(vb1), length(vb2), length(vb3)
+FROM t2;
+length(c1)	length(c2)	length(c3)	length(b1)	length(b2)	length(b2)	length(vc1)	length(vc2)	length(vc3)	length(vb1)	length(vb2)	length(vb3)
+1	2	128	1	2	2	1	2	512	1	2	512
+SELECT COUNT(*) FROM t2 NATURAL JOIN t2_myisam;
+COUNT(*)
+1
+DROP TABLE t2_myisam;
+************************************************************
+* Restoring table with 2nd degree demoted char+binary types:
+*     char(2)            -->    char(1)
+*     char(128)          -->    char(1)
+*     char(255)          -->    char(2)
+*     binary(2)          -->    binary(1)
+*     binary(128)        -->    binary(1)
+*     binary(255)        -->    binary(2)
+*     varchar(2)         -->    varchar(1)
+*     varchar(255)       -->    varchar(1)
+*     varchar(1024)      -->    varchar(255)
+*     varbinary(2)       -->    varbinary(1)
+*     varbinary(255)     -->    varbinary(1)
+*     varbinary(1024)    -->    varbinary(255)
+************************************************************
+ALTER TABLE t2
+modify c1 char(1), modify c2 char(1), modify c3 char(2),
+modify b1 binary(1), modify b2 binary(1), modify b3 binary(2),
+modify vc1 varchar(1), modify vc2 varchar(1), modify vc3 varchar(255),
+modify vb1 varbinary(1), modify vb2 varbinary(1), modify vb3 varbinary(255);
+SELECT
+length(c1), length(c2), length(c3),
+length(b1), length(b2), length(b2),
+length(vc1), length(vc2), length(vc3),
+length(vb1), length(vb2), length(vb3)
+FROM t2;
+length(c1)	length(c2)	length(c3)	length(b1)	length(b2)	length(b2)	length(vc1)	length(vc2)	length(vc3)	length(vb1)	length(vb2)	length(vb3)
+1	1	2	1	1	1	1	1	255	1	1	255
+CREATE TABLE t2_myisam ENGINE=MYISAM AS SELECT * FROM t2;
+DELETE FROM t2;
+SELECT
+length(c1), length(c2), length(c3),
+length(b1), length(b2), length(b2),
+length(vc1), length(vc2), length(vc3),
+length(vb1), length(vb2), length(vb3)
+FROM t2;
+length(c1)	length(c2)	length(c3)	length(b1)	length(b2)	length(b2)	length(vc1)	length(vc2)	length(vc3)	length(vb1)	length(vb2)	length(vb3)
+1	1	2	1	1	1	1	1	255	1	1	255
+SELECT COUNT(*) FROM t2 NATURAL JOIN t2_myisam;
+COUNT(*)
+1
+DROP TABLE t2_myisam;
+************************************************************
+* Restoring table with 3rd degree demoted char+binary types:
+*     char(2)            -->    char(1)
+*     char(128)          -->    char(1)
+*     char(255)          -->    char(1)
+*     binary(2)          -->    binary(1)
+*     binary(128)        -->    binary(1)
+*     binary(255)        -->    binary(1)
+*     varchar(2)         -->    varchar(1)
+*     varchar(255)       -->    varchar(1)
+*     varchar(1024)      -->    varchar(1)
+*     varbinary(2)       -->    varbinary(1)
+*     varbinary(255)     -->    varbinary(1)
+*     varbinary(1024)    -->    varbinary(1)
+************************************************************
+ALTER TABLE t2
+modify c1 char(1), modify c2 char(1), modify c3 char(1),
+modify b1 binary(1), modify b2 binary(1), modify b3 binary(1),
+modify vc1 varchar(1), modify vc2 varchar(1), modify vc3 varchar(1),
+modify vb1 varbinary(1), modify vb2 varbinary(1), modify vb3 varbinary(1);
+SELECT
+length(c1), length(c2), length(c3),
+length(b1), length(b2), length(b2),
+length(vc1), length(vc2), length(vc3),
+length(vb1), length(vb2), length(vb3)
+FROM t2;
+length(c1)	length(c2)	length(c3)	length(b1)	length(b2)	length(b2)	length(vc1)	length(vc2)	length(vc3)	length(vb1)	length(vb2)	length(vb3)
+1	1	1	1	1	1	1	1	1	1	1	1
+CREATE TABLE t2_myisam ENGINE=MYISAM AS SELECT * FROM t2;
+DELETE FROM t2;
+SELECT
+length(c1), length(c2), length(c3),
+length(b1), length(b2), length(b2),
+length(vc1), length(vc2), length(vc3),
+length(vb1), length(vb2), length(vb3)
+FROM t2;
+length(c1)	length(c2)	length(c3)	length(b1)	length(b2)	length(b2)	length(vc1)	length(vc2)	length(vc3)	length(vb1)	length(vb2)	length(vb3)
+1	1	1	1	1	1	1	1	1	1	1	1
+SELECT COUNT(*) FROM t2 NATURAL JOIN t2_myisam;
+COUNT(*)
+1
+DROP TABLE t2_myisam;
+************************************************************
+* Restoring table with changed var-ness of char+binary types:
+*     char(2)            -->    varchar(2)
+*     char(128)          -->    varchar(128)
+*     char(255)          -->    varchar(255)
+*     binary(2)          -->    varbinary(2)
+*     binary(128)        -->    varbinary(128)
+*     binary(255)        -->    varbinary(255)
+*     varchar(2)         -->    char(2)
+*     varchar(255)       -->    char(255)
+*     varchar(1024)      -->    varchar(1024)
+*     varbinary(2)       -->    binary(2)
+*     varbinary(255)     -->    binary(255)
+*     varbinary(1024)    -->    varbinary(1024)
+************************************************************
+DELETE FROM t2;
+ALTER TABLE t2
+modify c1 varchar(2), modify c2 varchar(128), modify c3 varchar(255),
+modify b1 varbinary(2), modify b2 varbinary(128), modify b3 varbinary(255),
+modify vc1 char(2), modify vc2 char(255), modify vc3 varchar(1024),
+modify vb1 binary(2), modify vb2 binary(255), modify vb3 varbinary(1024);
+INSERT INTO t2 VALUES(
+repeat('a', 2), repeat('b', 128), repeat('c', 255),
+repeat('d', 2), repeat('e', 128), repeat('f', 255),
+repeat('g', 2), repeat('h', 255), repeat('i', 1024),
+repeat('j', 2), repeat('k', 255), repeat('l', 1024)
+);
+SELECT
+length(c1), length(c2), length(c3),
+length(b1), length(b2), length(b2),
+length(vc1), length(vc2), length(vc3),
+length(vb1), length(vb2), length(vb3)
+FROM t2;
+length(c1)	length(c2)	length(c3)	length(b1)	length(b2)	length(b2)	length(vc1)	length(vc2)	length(vc3)	length(vb1)	length(vb2)	length(vb3)
+2	128	255	2	128	128	2	255	1024	2	255	1024
+CREATE TABLE t2_myisam ENGINE=MYISAM AS SELECT * FROM t2;
+DELETE FROM t2;
+SELECT
+length(c1), length(c2), length(c3),
+length(b1), length(b2), length(b2),
+length(vc1), length(vc2), length(vc3),
+length(vb1), length(vb2), length(vb3)
+FROM t2;
+length(c1)	length(c2)	length(c3)	length(b1)	length(b2)	length(b2)	length(vc1)	length(vc2)	length(vc3)	length(vb1)	length(vb2)	length(vb3)
+2	128	255	2	128	128	2	255	1024	2	255	1024
+SELECT COUNT(*) FROM t2 NATURAL JOIN t2_myisam;
+COUNT(*)
+1
+DROP TABLE t2_myisam;
+************************************************************
+* Restoring table with changed varness + 1st degree demoted types:
+*     char(2)            -->    varchar(1)
+*     char(128)          -->    varchar(2)
+*     char(255)          -->    varchar(128)
+*     binary(2)          -->    varbinary(1)
+*     binary(128)        -->    varbinary(2)
+*     binary(255)        -->    varbinary(128)
+*     varchar(2)         -->    char(1)
+*     varchar(255)       -->    char(2)
+*     varchar(1024)      -->    char(255)
+*     varbinary(2)       -->    binary(1)
+*     varbinary(255)     -->    binary(2)
+*     varbinary(1024)    -->    binary(255)
+************************************************************
+DELETE FROM t2;
+ALTER TABLE t2
+modify c1 varchar(1), modify c2 varchar(2), modify c3 varchar(128),
+modify b1 varbinary(1), modify b2 varbinary(2), modify b3 varbinary(128),
+modify vc1 char(1), modify vc2 char(2), modify vc3 char(255),
+modify vb1 binary(1), modify vb2 binary(2), modify vb3 binary(255);
+INSERT INTO t2 VALUES(
+repeat('a', 2), repeat('b', 128), repeat('c', 255),
+repeat('d', 2), repeat('e', 128), repeat('f', 255),
+repeat('g', 2), repeat('h', 255), repeat('i', 1024),
+repeat('j', 2), repeat('k', 255), repeat('l', 1024)
+);
+SELECT
+length(c1), length(c2), length(c3),
+length(b1), length(b2), length(b2),
+length(vc1), length(vc2), length(vc3),
+length(vb1), length(vb2), length(vb3)
+FROM t2;
+length(c1)	length(c2)	length(c3)	length(b1)	length(b2)	length(b2)	length(vc1)	length(vc2)	length(vc3)	length(vb1)	length(vb2)	length(vb3)
+1	2	128	1	2	2	1	2	255	1	2	255
+CREATE TABLE t2_myisam ENGINE=MYISAM AS SELECT * FROM t2;
+DELETE FROM t2;
+SELECT
+length(c1), length(c2), length(c3),
+length(b1), length(b2), length(b2),
+length(vc1), length(vc2), length(vc3),
+length(vb1), length(vb2), length(vb3)
+FROM t2;
+length(c1)	length(c2)	length(c3)	length(b1)	length(b2)	length(b2)	length(vc1)	length(vc2)	length(vc3)	length(vb1)	length(vb2)	length(vb3)
+1	2	128	1	2	2	1	2	255	1	2	255
+SELECT COUNT(*) FROM t2 NATURAL JOIN t2_myisam;
+COUNT(*)
+1
+DROP TABLE t2_myisam;
+************************************************************
+* Restoring table with changed varness + 2nd degree demoted types:
+*     char(2)            -->    varchar(1)
+*     char(128)          -->    varchar(1)
+*     char(255)          -->    varchar(2)
+*     binary(2)          -->    varbinary(1)
+*     binary(128)        -->    varbinary(1)
+*     binary(255)        -->    varbinary(2)
+*     varchar(2)         -->    char(1)
+*     varchar(255)       -->    char(1)
+*     varchar(1024)      -->    char(255)
+*     varbinary(2)       -->    binary(1)
+*     varbinary(255)     -->    binary(1)
+*     varbinary(1024)    -->    binary(255)
+************************************************************
+DELETE FROM t2;
+ALTER TABLE t2
+modify c1 varchar(1), modify c2 varchar(1), modify c3 varchar(2),
+modify b1 varbinary(1), modify b2 varbinary(1), modify b3 varbinary(2),
+modify vc1 char(1), modify vc2 char(1), modify vc3 char(255),
+modify vb1 binary(1), modify vb2 binary(1), modify vb3 binary(255);
+INSERT INTO t2 VALUES(
+repeat('a', 2), repeat('b', 128), repeat('c', 255),
+repeat('d', 2), repeat('e', 128), repeat('f', 255),
+repeat('g', 2), repeat('h', 255), repeat('i', 1024),
+repeat('j', 2), repeat('k', 255), repeat('l', 1024)
+);
+SELECT
+length(c1), length(c2), length(c3),
+length(b1), length(b2), length(b2),
+length(vc1), length(vc2), length(vc3),
+length(vb1), length(vb2), length(vb3)
+FROM t2;
+length(c1)	length(c2)	length(c3)	length(b1)	length(b2)	length(b2)	length(vc1)	length(vc2)	length(vc3)	length(vb1)	length(vb2)	length(vb3)
+1	1	2	1	1	1	1	1	255	1	1	255
+CREATE TABLE t2_myisam ENGINE=MYISAM AS SELECT * FROM t2;
+DELETE FROM t2;
+SELECT
+length(c1), length(c2), length(c3),
+length(b1), length(b2), length(b2),
+length(vc1), length(vc2), length(vc3),
+length(vb1), length(vb2), length(vb3)
+FROM t2;
+length(c1)	length(c2)	length(c3)	length(b1)	length(b2)	length(b2)	length(vc1)	length(vc2)	length(vc3)	length(vb1)	length(vb2)	length(vb3)
+1	1	2	1	1	1	1	1	255	1	1	255
+SELECT COUNT(*) FROM t2 NATURAL JOIN t2_myisam;
+COUNT(*)
+1
+DROP TABLE t2_myisam;
+************************************************************
+* Restoring table with changed varness + 3rd degree demoted types:
+*     char(2)            -->    varchar(1)
+*     char(128)          -->    varchar(1)
+*     char(255)          -->    varchar(1)
+*     binary(2)          -->    varbinary(1)
+*     binary(128)        -->    varbinary(1)
+*     binary(255)        -->    varbinary(1)
+*     varchar(2)         -->    char(1)
+*     varchar(255)       -->    char(1)
+*     varchar(1024)      -->    char(1)
+*     varbinary(2)       -->    binary(1)
+*     varbinary(255)     -->    binary(1)
+*     varbinary(1024)    -->    binary(1)
+************************************************************
+DELETE FROM t2;
+ALTER TABLE t2
+modify c1 varchar(1), modify c2 varchar(1), modify c3 varchar(1),
+modify b1 varbinary(1), modify b2 varbinary(1), modify b3 varbinary(1),
+modify vc1 char(1), modify vc2 char(1), modify vc3 char(1),
+modify vb1 binary(1), modify vb2 binary(1), modify vb3 binary(1);
+INSERT INTO t2 VALUES(
+repeat('a', 2), repeat('b', 128), repeat('c', 255),
+repeat('d', 2), repeat('e', 128), repeat('f', 255),
+repeat('g', 2), repeat('h', 255), repeat('i', 1024),
+repeat('j', 2), repeat('k', 255), repeat('l', 1024)
+);
+SELECT
+length(c1), length(c2), length(c3),
+length(b1), length(b2), length(b2),
+length(vc1), length(vc2), length(vc3),
+length(vb1), length(vb2), length(vb3)
+FROM t2;
+length(c1)	length(c2)	length(c3)	length(b1)	length(b2)	length(b2)	length(vc1)	length(vc2)	length(vc3)	length(vb1)	length(vb2)	length(vb3)
+1	1	1	1	1	1	1	1	1	1	1	1
+CREATE TABLE t2_myisam ENGINE=MYISAM AS SELECT * FROM t2;
+DELETE FROM t2;
+SELECT
+length(c1), length(c2), length(c3),
+length(b1), length(b2), length(b2),
+length(vc1), length(vc2), length(vc3),
+length(vb1), length(vb2), length(vb3)
+FROM t2;
+length(c1)	length(c2)	length(c3)	length(b1)	length(b2)	length(b2)	length(vc1)	length(vc2)	length(vc3)	length(vb1)	length(vb2)	length(vb3)
+1	1	1	1	1	1	1	1	1	1	1	1
+SELECT COUNT(*) FROM t2 NATURAL JOIN t2_myisam;
+COUNT(*)
+1
+DROP TABLE t2_myisam;
+************************************************************
+* Deleting table with char+binary types
+************************************************************
+DROP TABLE t2;

=== added file 'mysql-test/suite/ndb/r/ndb_restore_lossy_integral_conv.result'
--- a/mysql-test/suite/ndb/r/ndb_restore_lossy_integral_conv.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/r/ndb_restore_lossy_integral_conv.result	2010-10-22 05:47:04 +0000
@@ -0,0 +1,451 @@
+************************************************************
+* Creating table with integral types
+************************************************************
+CREATE TABLE t1(
+t1 tinyint,  t2 tinyint,  ut1 tinyint unsigned,
+s1 smallint,  s2 smallint,  us1 smallint unsigned,
+m1 mediumint,  m2 mediumint,  um1 mediumint unsigned,
+i1 int,  i2 int,  ui1 int unsigned,
+b1 bigint,  b2 bigint,  ub1 bigint unsigned
+) ENGINE=NDB;
+INSERT INTO t1 VALUES(
+-128, 127, 255,
+-32768, 32767, 65535,
+-8388608, 8388607, 16777215,
+-2147483648, 2147483647, 4294967295,
+-9223372036854775808, 9223372036854775807, 18446744073709551615
+);
+************************************************************
+* Backing up table with integral types
+************************************************************
+************************************************************
+* Restoring table with unchanged integral types:
+*     tinyint[unsigned]  -->    tinyint[unsigned]
+*    smallint[unsigned]  -->   smallint[unsigned]
+*   mediumint[unsigned]  -->  mediumint[unsigned]
+*         int[unsigned]  -->        int[unsigned]
+*      bigint[unsigned]  -->     bigint[unsigned]
+************************************************************
+CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1;
+DELETE FROM t1;
+SELECT * FROM t1;
+t1	t2	ut1	s1	s2	us1	m1	m2	um1	i1	i2	ui1	b1	b2	ub1
+-128	127	255	-32768	32767	65535	-8388608	8388607	16777215	-2147483648	2147483647	4294967295	-9223372036854775808	9223372036854775807	18446744073709551615
+SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam;
+COUNT(*)
+1
+DROP TABLE t1_myisam;
+************************************************************
+* Restoring table with 1st degree demoted integral types:
+*     tinyint[unsigned]  -->    tinyint[unsigned]
+*    smallint[unsigned]  -->    tinyint[unsigned]
+*   mediumint[unsigned]  -->   smallint[unsigned]
+*         int[unsigned]  -->  mediumint[unsigned]
+*      bigint[unsigned]  -->        int[unsigned]
+************************************************************
+ALTER TABLE t1
+modify t1 tinyint,  modify t2 tinyint,  modify ut1 tinyint unsigned,
+modify s1 tinyint,  modify s2 tinyint,  modify us1 tinyint unsigned,
+modify m1 smallint,  modify m2 smallint,  modify um1 smallint unsigned,
+modify i1 mediumint,  modify i2 mediumint,  modify ui1 mediumint unsigned,
+modify b1 int,  modify b2 int,  modify ub1 int unsigned;
+SELECT * FROM t1;
+t1	t2	ut1	s1	s2	us1	m1	m2	um1	i1	i2	ui1	b1	b2	ub1
+-128	127	255	-128	127	255	-32768	32767	65535	-8388608	8388607	16777215	-2147483648	2147483647	4294967295
+CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1;
+DELETE FROM t1;
+SELECT * FROM t1;
+t1	t2	ut1	s1	s2	us1	m1	m2	um1	i1	i2	ui1	b1	b2	ub1
+-128	127	255	-128	127	255	-32768	32767	65535	-8388608	8388607	16777215	-2147483648	2147483647	4294967295
+SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam;
+COUNT(*)
+1
+DROP TABLE t1_myisam;
+************************************************************
+* Restoring table with 2nd degree demoted integral types:
+*     tinyint[unsigned]  -->    tinyint[unsigned]
+*    smallint[unsigned]  -->    tinyint[unsigned]
+*   mediumint[unsigned]  -->    tinyint[unsigned]
+*         int[unsigned]  -->   smallint[unsigned]
+*      bigint[unsigned]  -->  mediumint[unsigned]
+************************************************************
+ALTER TABLE t1
+modify t1 tinyint,  modify t2 tinyint,  modify ut1 tinyint unsigned,
+modify s1 tinyint,  modify s2 tinyint,  modify us1 tinyint unsigned,
+modify m1 tinyint,  modify m2 tinyint,  modify um1 tinyint unsigned,
+modify i1 smallint,  modify i2 smallint,  modify ui1 smallint unsigned,
+modify b1 mediumint,  modify b2 mediumint,  modify ub1 mediumint unsigned;
+SELECT * FROM t1;
+t1	t2	ut1	s1	s2	us1	m1	m2	um1	i1	i2	ui1	b1	b2	ub1
+-128	127	255	-128	127	255	-128	127	255	-32768	32767	65535	-8388608	8388607	16777215
+CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1;
+DELETE FROM t1;
+SELECT * FROM t1;
+t1	t2	ut1	s1	s2	us1	m1	m2	um1	i1	i2	ui1	b1	b2	ub1
+-128	127	255	-128	127	255	-128	127	255	-32768	32767	65535	-8388608	8388607	16777215
+SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam;
+COUNT(*)
+1
+DROP TABLE t1_myisam;
+************************************************************
+* Restoring table with 3rd degree demoted integral types:
+*     tinyint[unsigned]  -->    tinyint[unsigned]
+*    smallint[unsigned]  -->    tinyint[unsigned]
+*   mediumint[unsigned]  -->    tinyint[unsigned]
+*         int[unsigned]  -->    tinyint[unsigned]
+*      bigint[unsigned]  -->   smallint[unsigned]
+************************************************************
+ALTER TABLE t1
+modify t1 tinyint,  modify t2 tinyint,  modify ut1 tinyint unsigned,
+modify s1 tinyint,  modify s2 tinyint,  modify us1 tinyint unsigned,
+modify m1 tinyint,  modify m2 tinyint,  modify um1 tinyint unsigned,
+modify i1 tinyint,  modify i2 tinyint,  modify ui1 tinyint unsigned,
+modify b1 smallint,  modify b2 smallint,  modify ub1 smallint unsigned;
+SELECT * FROM t1;
+t1	t2	ut1	s1	s2	us1	m1	m2	um1	i1	i2	ui1	b1	b2	ub1
+-128	127	255	-128	127	255	-128	127	255	-128	127	255	-32768	32767	65535
+CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1;
+DELETE FROM t1;
+SELECT * FROM t1;
+t1	t2	ut1	s1	s2	us1	m1	m2	um1	i1	i2	ui1	b1	b2	ub1
+-128	127	255	-128	127	255	-128	127	255	-128	127	255	-32768	32767	65535
+SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam;
+COUNT(*)
+1
+DROP TABLE t1_myisam;
+************************************************************
+* Restoring table with 4th degree demoted integral types:
+*     tinyint[unsigned]  -->    tinyint[unsigned]
+*    smallint[unsigned]  -->    tinyint[unsigned]
+*   mediumint[unsigned]  -->    tinyint[unsigned]
+*         int[unsigned]  -->    tinyint[unsigned]
+*      bigint[unsigned]  -->    tinyint[unsigned]
+************************************************************
+ALTER TABLE t1
+modify t1 tinyint,  modify t2 tinyint,  modify ut1 tinyint unsigned,
+modify s1 tinyint,  modify s2 tinyint,  modify us1 tinyint unsigned,
+modify m1 tinyint,  modify m2 tinyint,  modify um1 tinyint unsigned,
+modify i1 tinyint,  modify i2 tinyint,  modify ui1 tinyint unsigned,
+modify b1 tinyint,  modify b2 tinyint,  modify ub1 tinyint unsigned;
+SELECT * FROM t1;
+t1	t2	ut1	s1	s2	us1	m1	m2	um1	i1	i2	ui1	b1	b2	ub1
+-128	127	255	-128	127	255	-128	127	255	-128	127	255	-128	127	255
+CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1;
+DELETE FROM t1;
+SELECT * FROM t1;
+t1	t2	ut1	s1	s2	us1	m1	m2	um1	i1	i2	ui1	b1	b2	ub1
+-128	127	255	-128	127	255	-128	127	255	-128	127	255	-128	127	255
+SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam;
+COUNT(*)
+1
+DROP TABLE t1_myisam;
+************************************************************
+* Restoring table with changed signedness:
+*     tinyint unsigned/signed  -->    tinyint signed/unsigned
+*    smallint unsigned/signed  -->   smallint signed/unsigned
+*   mediumint unsigned/signed  -->  mediumint signed/unsigned
+*         int unsigned/signed  -->        int signed/unsigned
+*      bigint unsigned/signed  -->     bigint signed/unsigned
+************************************************************
+DELETE FROM t1;
+ALTER TABLE t1
+modify t1 tinyint unsigned,  modify t2 tinyint unsigned,  modify ut1 tinyint signed,
+modify s1 smallint unsigned,  modify s2 smallint unsigned,  modify us1 smallint signed,
+modify m1 mediumint unsigned,  modify m2 mediumint unsigned,  modify um1 mediumint signed,
+modify i1 int unsigned,  modify i2 int unsigned,  modify ui1 int signed,
+modify b1 bigint unsigned,  modify b2 bigint unsigned,  modify ub1 bigint signed;
+INSERT INTO t1 VALUES(
+-128, 127, 255,
+-32768, 32767, 65535,
+-8388608, 8388607, 16777215,
+-2147483648, 2147483647, 4294967295,
+-9223372036854775808, 9223372036854775807, 18446744073709551615
+);
+SELECT * FROM t1;
+t1	t2	ut1	s1	s2	us1	m1	m2	um1	i1	i2	ui1	b1	b2	ub1
+0	127	127	0	32767	32767	0	8388607	8388607	0	2147483647	2147483647	0	9223372036854775807	9223372036854775807
+CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1;
+DELETE FROM t1;
+SELECT * FROM t1;
+t1	t2	ut1	s1	s2	us1	m1	m2	um1	i1	i2	ui1	b1	b2	ub1
+0	127	127	0	32767	32767	0	8388607	8388607	0	2147483647	2147483647	0	9223372036854775807	9223372036854775807
+SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam;
+COUNT(*)
+1
+DROP TABLE t1_myisam;
+************************************************************
+* Restoring table with changed signedness + 1st degree promoted types:
+*     tinyint unsigned/signed  -->   smallint signed/unsigned
+*    smallint unsigned/signed  -->  mediumint signed/unsigned
+*   mediumint unsigned/signed  -->        int signed/unsigned
+*         int unsigned/signed  -->     bigint signed/unsigned
+*      bigint unsigned/signed  -->     bigint signed/unsigned
+************************************************************
+DELETE FROM t1;
+ALTER TABLE t1
+modify t1 smallint unsigned,  modify t2 smallint unsigned,  modify ut1 smallint signed,
+modify s1 mediumint unsigned,  modify s2 mediumint unsigned,  modify us1 mediumint signed,
+modify m1 int unsigned,  modify m2 int unsigned,  modify um1 int signed,
+modify i1 bigint unsigned,  modify i2 bigint unsigned,  modify ui1 bigint signed,
+modify b1 bigint unsigned,  modify b2 bigint unsigned,  modify ub1 bigint signed;
+INSERT INTO t1 VALUES(
+-128, 127, 255,
+-32768, 32767, 65535,
+-8388608, 8388607, 16777215,
+-2147483648, 2147483647, 4294967295,
+-9223372036854775808, 9223372036854775807, 18446744073709551615
+);
+SELECT * FROM t1;
+t1	t2	ut1	s1	s2	us1	m1	m2	um1	i1	i2	ui1	b1	b2	ub1
+0	127	255	0	32767	65535	0	8388607	16777215	0	2147483647	4294967295	0	9223372036854775807	9223372036854775807
+CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1;
+DELETE FROM t1;
+SELECT * FROM t1;
+t1	t2	ut1	s1	s2	us1	m1	m2	um1	i1	i2	ui1	b1	b2	ub1
+0	127	255	0	32767	65535	0	8388607	16777215	0	2147483647	4294967295	0	9223372036854775807	9223372036854775807
+SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam;
+COUNT(*)
+1
+DROP TABLE t1_myisam;
+************************************************************
+* Restoring table with changed signedness + 2nd degree promoted types:
+*     tinyint unsigned/signed  -->  mediumint signed/unsigned
+*    smallint unsigned/signed  -->        int signed/unsigned
+*   mediumint unsigned/signed  -->     bigint signed/unsigned
+*         int unsigned/signed  -->     bigint signed/unsigned
+*      bigint unsigned/signed  -->     bigint signed/unsigned
+************************************************************
+DELETE FROM t1;
+ALTER TABLE t1
+modify t1 mediumint unsigned,  modify t2 mediumint unsigned,  modify ut1 mediumint signed,
+modify s1 int unsigned,  modify s2 int unsigned,  modify us1 int signed,
+modify m1 bigint unsigned,  modify m2 bigint unsigned,  modify um1 bigint signed,
+modify i1 bigint unsigned,  modify i2 bigint unsigned,  modify ui1 bigint signed,
+modify b1 bigint unsigned,  modify b2 bigint unsigned,  modify ub1 bigint signed;
+INSERT INTO t1 VALUES(
+-128, 127, 255,
+-32768, 32767, 65535,
+-8388608, 8388607, 16777215,
+-2147483648, 2147483647, 4294967295,
+-9223372036854775808, 9223372036854775807, 18446744073709551615
+);
+SELECT * FROM t1;
+t1	t2	ut1	s1	s2	us1	m1	m2	um1	i1	i2	ui1	b1	b2	ub1
+0	127	255	0	32767	65535	0	8388607	16777215	0	2147483647	4294967295	0	9223372036854775807	9223372036854775807
+CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1;
+DELETE FROM t1;
+SELECT * FROM t1;
+t1	t2	ut1	s1	s2	us1	m1	m2	um1	i1	i2	ui1	b1	b2	ub1
+0	127	255	0	32767	65535	0	8388607	16777215	0	2147483647	4294967295	0	9223372036854775807	9223372036854775807
+SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam;
+COUNT(*)
+1
+DROP TABLE t1_myisam;
+************************************************************
+* Restoring table with changed signedness + 3rd degree promoted types:
+*     tinyint unsigned/signed  -->        int signed/unsigned
+*    smallint unsigned/signed  -->     bigint signed/unsigned
+*   mediumint unsigned/signed  -->     bigint signed/unsigned
+*         int unsigned/signed  -->     bigint signed/unsigned
+*      bigint unsigned/signed  -->     bigint signed/unsigned
+************************************************************
+DELETE FROM t1;
+ALTER TABLE t1
+modify t1 int unsigned,  modify t2 int unsigned,  modify ut1 int signed,
+modify s1 bigint unsigned,  modify s2 bigint unsigned,  modify us1 bigint signed,
+modify m1 bigint unsigned,  modify m2 bigint unsigned,  modify um1 bigint signed,
+modify i1 bigint unsigned,  modify i2 bigint unsigned,  modify ui1 bigint signed,
+modify b1 bigint unsigned,  modify b2 bigint unsigned,  modify ub1 bigint signed;
+INSERT INTO t1 VALUES(
+-128, 127, 255,
+-32768, 32767, 65535,
+-8388608, 8388607, 16777215,
+-2147483648, 2147483647, 4294967295,
+-9223372036854775808, 9223372036854775807, 18446744073709551615
+);
+SELECT * FROM t1;
+t1	t2	ut1	s1	s2	us1	m1	m2	um1	i1	i2	ui1	b1	b2	ub1
+0	127	255	0	32767	65535	0	8388607	16777215	0	2147483647	4294967295	0	9223372036854775807	9223372036854775807
+CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1;
+DELETE FROM t1;
+SELECT * FROM t1;
+t1	t2	ut1	s1	s2	us1	m1	m2	um1	i1	i2	ui1	b1	b2	ub1
+0	127	255	0	32767	65535	0	8388607	16777215	0	2147483647	4294967295	0	9223372036854775807	9223372036854775807
+SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam;
+COUNT(*)
+1
+DROP TABLE t1_myisam;
+************************************************************
+* Restoring table with changed signedness + 4th degree promoted types:
+*     tinyint unsigned/signed  -->     bigint signed/unsigned
+*    smallint unsigned/signed  -->     bigint signed/unsigned
+*   mediumint unsigned/signed  -->     bigint signed/unsigned
+*         int unsigned/signed  -->     bigint signed/unsigned
+*      bigint unsigned/signed  -->     bigint signed/unsigned
+************************************************************
+DELETE FROM t1;
+ALTER TABLE t1
+modify t1 bigint unsigned,  modify t2 bigint unsigned,  modify ut1 bigint signed,
+modify s1 bigint unsigned,  modify s2 bigint unsigned,  modify us1 bigint signed,
+modify m1 bigint unsigned,  modify m2 bigint unsigned,  modify um1 bigint signed,
+modify i1 bigint unsigned,  modify i2 bigint unsigned,  modify ui1 bigint signed,
+modify b1 bigint unsigned,  modify b2 bigint unsigned,  modify ub1 bigint signed;
+INSERT INTO t1 VALUES(
+-128, 127, 255,
+-32768, 32767, 65535,
+-8388608, 8388607, 16777215,
+-2147483648, 2147483647, 4294967295,
+-9223372036854775808, 9223372036854775807, 18446744073709551615
+);
+SELECT * FROM t1;
+t1	t2	ut1	s1	s2	us1	m1	m2	um1	i1	i2	ui1	b1	b2	ub1
+0	127	255	0	32767	65535	0	8388607	16777215	0	2147483647	4294967295	0	9223372036854775807	9223372036854775807
+CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1;
+DELETE FROM t1;
+SELECT * FROM t1;
+t1	t2	ut1	s1	s2	us1	m1	m2	um1	i1	i2	ui1	b1	b2	ub1
+0	127	255	0	32767	65535	0	8388607	16777215	0	2147483647	4294967295	0	9223372036854775807	9223372036854775807
+SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam;
+COUNT(*)
+1
+DROP TABLE t1_myisam;
+************************************************************
+* Restoring table with changed signedness + 1st degree demoted types:
+*     tinyint unsigned/signed  -->    tinyint signed/unsigned
+*    smallint unsigned/signed  -->    tinyint signed/unsigned
+*   mediumint unsigned/signed  -->   smallint signed/unsigned
+*         int unsigned/signed  -->  mediumint signed/unsigned
+*      bigint unsigned/signed  -->        int signed/unsigned
+************************************************************
+DELETE FROM t1;
+ALTER TABLE t1
+modify t1 tinyint unsigned,  modify t2 tinyint unsigned,  modify ut1 tinyint signed,
+modify s1 tinyint unsigned,  modify s2 tinyint unsigned,  modify us1 tinyint signed,
+modify m1 smallint unsigned,  modify m2 smallint unsigned,  modify um1 smallint signed,
+modify i1 mediumint unsigned,  modify i2 mediumint unsigned,  modify ui1 mediumint signed,
+modify b1 int unsigned,  modify b2 int unsigned,  modify ub1 int signed;
+INSERT INTO t1 VALUES(
+-128, 127, 255,
+-32768, 32767, 65535,
+-8388608, 8388607, 16777215,
+-2147483648, 2147483647, 4294967295,
+-9223372036854775808, 9223372036854775807, 18446744073709551615
+);
+SELECT * FROM t1;
+t1	t2	ut1	s1	s2	us1	m1	m2	um1	i1	i2	ui1	b1	b2	ub1
+0	127	127	0	255	127	0	65535	32767	0	16777215	8388607	0	4294967295	2147483647
+CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1;
+DELETE FROM t1;
+SELECT * FROM t1;
+t1	t2	ut1	s1	s2	us1	m1	m2	um1	i1	i2	ui1	b1	b2	ub1
+0	127	127	0	255	127	0	65535	32767	0	16777215	8388607	0	4294967295	2147483647
+SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam;
+COUNT(*)
+1
+DROP TABLE t1_myisam;
+************************************************************
+* Restoring table with changed signedness + 2nd degree demoted types:
+*     tinyint unsigned/signed  -->    tinyint signed/unsigned
+*    smallint unsigned/signed  -->    tinyint signed/unsigned
+*   mediumint unsigned/signed  -->    tinyint signed/unsigned
+*         int unsigned/signed  -->   smallint signed/unsigned
+*      bigint unsigned/signed  -->  mediumint signed/unsigned
+************************************************************
+DELETE FROM t1;
+ALTER TABLE t1
+modify t1 tinyint unsigned,  modify t2 tinyint unsigned,  modify ut1 tinyint signed,
+modify s1 tinyint unsigned,  modify s2 tinyint unsigned,  modify us1 tinyint signed,
+modify m1 tinyint unsigned,  modify m2 tinyint unsigned,  modify um1 tinyint signed,
+modify i1 smallint unsigned,  modify i2 smallint unsigned,  modify ui1 smallint signed,
+modify b1 mediumint unsigned,  modify b2 mediumint unsigned,  modify ub1 mediumint signed;
+INSERT INTO t1 VALUES(
+-128, 127, 255,
+-32768, 32767, 65535,
+-8388608, 8388607, 16777215,
+-2147483648, 2147483647, 4294967295,
+-9223372036854775808, 9223372036854775807, 18446744073709551615
+);
+SELECT * FROM t1;
+t1	t2	ut1	s1	s2	us1	m1	m2	um1	i1	i2	ui1	b1	b2	ub1
+0	127	127	0	255	127	0	255	127	0	65535	32767	0	16777215	8388607
+CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1;
+DELETE FROM t1;
+SELECT * FROM t1;
+t1	t2	ut1	s1	s2	us1	m1	m2	um1	i1	i2	ui1	b1	b2	ub1
+0	127	127	0	255	127	0	255	127	0	65535	32767	0	16777215	8388607
+SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam;
+COUNT(*)
+1
+DROP TABLE t1_myisam;
+************************************************************
+* Restoring table with changed signedness + 3rd degree demoted types:
+*     tinyint unsigned/signed  -->    tinyint signed/unsigned
+*    smallint unsigned/signed  -->    tinyint signed/unsigned
+*   mediumint unsigned/signed  -->    tinyint signed/unsigned
+*         int unsigned/signed  -->    tinyint signed/unsigned
+*      bigint unsigned/signed  -->   smallint signed/unsigned
+************************************************************
+DELETE FROM t1;
+ALTER TABLE t1
+modify t1 tinyint unsigned,  modify t2 tinyint unsigned,  modify ut1 tinyint signed,
+modify s1 tinyint unsigned,  modify s2 tinyint unsigned,  modify us1 tinyint signed,
+modify m1 tinyint unsigned,  modify m2 tinyint unsigned,  modify um1 tinyint signed,
+modify i1 tinyint unsigned,  modify i2 tinyint unsigned,  modify ui1 tinyint signed,
+modify b1 smallint unsigned,  modify b2 smallint unsigned,  modify ub1 smallint signed;
+INSERT INTO t1 VALUES(
+-128, 127, 255,
+-32768, 32767, 65535,
+-8388608, 8388607, 16777215,
+-2147483648, 2147483647, 4294967295,
+-9223372036854775808, 9223372036854775807, 18446744073709551615
+);
+SELECT * FROM t1;
+t1	t2	ut1	s1	s2	us1	m1	m2	um1	i1	i2	ui1	b1	b2	ub1
+0	127	127	0	255	127	0	255	127	0	255	127	0	65535	32767
+CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1;
+DELETE FROM t1;
+SELECT * FROM t1;
+t1	t2	ut1	s1	s2	us1	m1	m2	um1	i1	i2	ui1	b1	b2	ub1
+0	127	127	0	255	127	0	255	127	0	255	127	0	65535	32767
+SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam;
+COUNT(*)
+1
+DROP TABLE t1_myisam;
+************************************************************
+* Restoring table with changed signedness + 4th degree demoted types:
+*     tinyint unsigned/signed  -->    tinyint signed/unsigned
+*    smallint unsigned/signed  -->    tinyint signed/unsigned
+*   mediumint unsigned/signed  -->    tinyint signed/unsigned
+*         int unsigned/signed  -->    tinyint signed/unsigned
+*      bigint unsigned/signed  -->    tinyint signed/unsigned
+************************************************************
+DELETE FROM t1;
+ALTER TABLE t1
+modify t1 tinyint unsigned,  modify t2 tinyint unsigned,  modify ut1 tinyint signed,
+modify s1 tinyint unsigned,  modify s2 tinyint unsigned,  modify us1 tinyint signed,
+modify m1 tinyint unsigned,  modify m2 tinyint unsigned,  modify um1 tinyint signed,
+modify i1 tinyint unsigned,  modify i2 tinyint unsigned,  modify ui1 tinyint signed,
+modify b1 tinyint unsigned,  modify b2 tinyint unsigned,  modify ub1 tinyint signed;
+INSERT INTO t1 VALUES(
+-128, 127, 255,
+-32768, 32767, 65535,
+-8388608, 8388607, 16777215,
+-2147483648, 2147483647, 4294967295,
+-9223372036854775808, 9223372036854775807, 18446744073709551615
+);
+SELECT * FROM t1;
+t1	t2	ut1	s1	s2	us1	m1	m2	um1	i1	i2	ui1	b1	b2	ub1
+0	127	127	0	255	127	0	255	127	0	255	127	0	255	127
+CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1;
+DELETE FROM t1;
+SELECT * FROM t1;
+t1	t2	ut1	s1	s2	us1	m1	m2	um1	i1	i2	ui1	b1	b2	ub1
+0	127	127	0	255	127	0	255	127	0	255	127	0	255	127
+SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam;
+COUNT(*)
+1
+DROP TABLE t1_myisam;
+************************************************************
+* Deleting table with integral types
+************************************************************
+DROP TABLE t1;

=== added file 'mysql-test/suite/ndb/r/ndb_restore_padding_preservation.result'
--- a/mysql-test/suite/ndb/r/ndb_restore_padding_preservation.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/r/ndb_restore_padding_preservation.result	2010-10-22 05:47:04 +0000
@@ -0,0 +1,178 @@
+************************************************************
+* Creating table with char+binary types
+************************************************************
+CREATE TABLE t3(
+c1 char(32),
+b1 binary(32)
+) ENGINE=NDB;
+INSERT INTO t3 VALUES('aaaaaaaa', 'bbbbbbbb');
+SELECT length(c1), length(b1) FROM t3;
+length(c1)	length(b1)
+8	32
+************************************************************
+* Backing up table with char+binary types
+************************************************************
+************************************************************
+* Restoring table with unchanged char+binary types (sanity check):
+*     char(32)           -->    char(32)
+*     binary(32)         -->    binary(32)
+************************************************************
+CREATE TABLE t3_myisam ENGINE=MYISAM AS SELECT * FROM t3;
+DELETE FROM t3;
+SELECT length(c1), length(b1) FROM t3;
+length(c1)	length(b1)
+8	32
+SELECT COUNT(*) FROM t3 NATURAL JOIN t3_myisam;
+COUNT(*)
+1
+DROP TABLE t3_myisam;
+************************************************************
+* Restoring table with promoted char+binary types preserving padding:
+*     char(32)           -->    varchar(32)
+*     binary(32)         -->    varbinary(32)
+************************************************************
+ALTER TABLE t3 MODIFY c1 varchar(32), MODIFY b1 varbinary(32);
+SELECT length(c1), length(b1) FROM t3;
+length(c1)	length(b1)
+8	32
+CREATE TABLE t3_myisam ENGINE=MYISAM AS SELECT * FROM t3;
+DELETE FROM t3;
+SELECT length(c1), length(b1) FROM t3;
+length(c1)	length(b1)
+32	32
+SELECT COUNT(*) FROM t3 NATURAL JOIN t3_myisam;
+COUNT(*)
+1
+DROP TABLE t3_myisam;
+************************************************************
+* Restoring table with promoted char+binary types preserving padding:
+*     char(32)           -->    varchar(64)
+*     binary(32)         -->    varbinary(64)
+************************************************************
+ALTER TABLE t3 MODIFY c1 varchar(64), MODIFY b1 varbinary(64);
+SELECT length(c1), length(b1) FROM t3;
+length(c1)	length(b1)
+32	32
+CREATE TABLE t3_myisam ENGINE=MYISAM AS SELECT * FROM t3;
+DELETE FROM t3;
+SELECT length(c1), length(b1) FROM t3;
+length(c1)	length(b1)
+32	32
+SELECT COUNT(*) FROM t3 NATURAL JOIN t3_myisam;
+COUNT(*)
+1
+DROP TABLE t3_myisam;
+************************************************************
+* Restoring table with promoted char+binary types preserving padding:
+*     char(32)           -->    varchar(512)
+*     binary(32)         -->    varbinary(512)
+************************************************************
+ALTER TABLE t3 MODIFY c1 varchar(512), MODIFY b1 varbinary(512);
+SELECT length(c1), length(b1) FROM t3;
+length(c1)	length(b1)
+32	32
+CREATE TABLE t3_myisam ENGINE=MYISAM AS SELECT * FROM t3;
+DELETE FROM t3;
+SELECT length(c1), length(b1) FROM t3;
+length(c1)	length(b1)
+32	32
+SELECT COUNT(*) FROM t3 NATURAL JOIN t3_myisam;
+COUNT(*)
+1
+DROP TABLE t3_myisam;
+************************************************************
+* Restoring table with demoted char+binary types preserving padding:
+*     char(32)           -->    varchar(16)
+*     binary(32)         -->    varbinary(16)
+************************************************************
+ALTER TABLE t3 MODIFY c1 varchar(16), MODIFY b1 varbinary(16);
+SELECT length(c1), length(b1) FROM t3;
+length(c1)	length(b1)
+16	16
+CREATE TABLE t3_myisam ENGINE=MYISAM AS SELECT * FROM t3;
+DELETE FROM t3;
+SELECT length(c1), length(b1) FROM t3;
+length(c1)	length(b1)
+16	16
+SELECT COUNT(*) FROM t3 NATURAL JOIN t3_myisam;
+COUNT(*)
+1
+DROP TABLE t3_myisam;
+************************************************************
+* Restoring table with promoted char+binary types discarding padding:
+*     char(32)           -->    varchar(32)
+*     binary(32)         -->    varbinary(32)
+************************************************************
+DELETE FROM t3;
+ALTER TABLE t3 MODIFY c1 varchar(32), MODIFY b1 varbinary(32);
+INSERT INTO t3 VALUES('aaaaaaaa', 'bbbbbbbb');
+SELECT length(c1), length(b1) FROM t3;
+length(c1)	length(b1)
+8	8
+CREATE TABLE t3_myisam ENGINE=MYISAM AS SELECT * FROM t3;
+DELETE FROM t3;
+SELECT length(c1), length(b1) FROM t3;
+length(c1)	length(b1)
+8	8
+SELECT COUNT(*) FROM t3 NATURAL JOIN t3_myisam;
+COUNT(*)
+1
+DROP TABLE t3_myisam;
+************************************************************
+* Restoring table with promoted char+binary types discarding padding:
+*     char(32)           -->    varchar(64)
+*     binary(32)         -->    varbinary(64)
+************************************************************
+ALTER TABLE t3 MODIFY c1 varchar(64), MODIFY b1 varbinary(64);
+SELECT length(c1), length(b1) FROM t3;
+length(c1)	length(b1)
+8	8
+CREATE TABLE t3_myisam ENGINE=MYISAM AS SELECT * FROM t3;
+DELETE FROM t3;
+SELECT length(c1), length(b1) FROM t3;
+length(c1)	length(b1)
+8	8
+SELECT COUNT(*) FROM t3 NATURAL JOIN t3_myisam;
+COUNT(*)
+1
+DROP TABLE t3_myisam;
+************************************************************
+* Restoring table with promoted char+binary types discarding padding:
+*     char(32)           -->    varchar(512)
+*     binary(32)         -->    varbinary(512)
+************************************************************
+ALTER TABLE t3 MODIFY c1 varchar(512), MODIFY b1 varbinary(512);
+SELECT length(c1), length(b1) FROM t3;
+length(c1)	length(b1)
+8	8
+CREATE TABLE t3_myisam ENGINE=MYISAM AS SELECT * FROM t3;
+DELETE FROM t3;
+SELECT length(c1), length(b1) FROM t3;
+length(c1)	length(b1)
+8	8
+SELECT COUNT(*) FROM t3 NATURAL JOIN t3_myisam;
+COUNT(*)
+1
+DROP TABLE t3_myisam;
+************************************************************
+* Restoring table with demoted char+binary types discarding padding:
+*     char(32)           -->    varchar(16)
+*     binary(32)         -->    varbinary(16)
+************************************************************
+ALTER TABLE t3 MODIFY c1 varchar(16), MODIFY b1 varbinary(16);
+SELECT length(c1), length(b1) FROM t3;
+length(c1)	length(b1)
+8	8
+CREATE TABLE t3_myisam ENGINE=MYISAM AS SELECT * FROM t3;
+DELETE FROM t3;
+SELECT length(c1), length(b1) FROM t3;
+length(c1)	length(b1)
+8	8
+SELECT COUNT(*) FROM t3 NATURAL JOIN t3_myisam;
+COUNT(*)
+1
+DROP TABLE t3_myisam;
+************************************************************
+* Deleting table with char+binary types
+************************************************************
+DROP TABLE t3;

=== added file 'mysql-test/suite/ndb/t/ndb_restore_lossy_charbinary_conv.test'
--- a/mysql-test/suite/ndb/t/ndb_restore_lossy_charbinary_conv.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/t/ndb_restore_lossy_charbinary_conv.test	2010-10-22 05:47:04 +0000
@@ -0,0 +1,455 @@
+######################################################################
+# Author: Martin Zaun
+# Date: 2010-10
+# Purpose: Lossy conversion test for [var]char and [var]binary types
+######################################################################
+
+-- source include/have_ndb.inc
+
+# mysqld's configuration is not relevant to this test
+-- source include/not_embedded.inc
+
+--echo ************************************************************
+--echo * Creating table with char+binary types
+--echo ************************************************************
+
+CREATE TABLE t2(
+  c1 char(2), c2 char(128), c3 char(255),
+  b1 binary(2), b2 binary(128), b3 binary(255),
+  vc1 varchar(2), vc2 varchar(255), vc3 varchar(1024),
+  vb1 varbinary(2), vb2 varbinary(255), vb3 varbinary(1024)
+) ENGINE=NDB;
+
+INSERT INTO t2 VALUES(
+  repeat('a', 2), repeat('b', 128), repeat('c', 255),
+  repeat('d', 2), repeat('e', 128), repeat('f', 255),
+  repeat('g', 2), repeat('h', 255), repeat('i', 1024),
+  repeat('j', 2), repeat('k', 255), repeat('l', 1024)
+);
+
+--echo ************************************************************
+--echo * Backing up table with char+binary types
+--echo ************************************************************
+
+--source include/ndb_backup.inc
+
+# command shortcuts
+#--let $restore_cmd=$NDB_RESTORE --no-defaults -b $the_backup_id -r
+#--let $restore_cmd=$restore_cmd --backup_path=$NDB_BACKUPS-$the_backup_id
+# for ndb 6.3:
+--let $restore_cmd=$NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id
+--let $restore_cmd=$restore_cmd -r --backup_path=$NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id
+
+--echo ************************************************************
+--echo * Restoring table with unchanged char+binary types:
+--echo *     char(2)            -->    char(2)
+--echo *     char(128)          -->    char(128)
+--echo *     char(255)          -->    char(255)
+--echo *     binary(2)          -->    binary(2)
+--echo *     binary(128)        -->    binary(128)
+--echo *     binary(255)        -->    binary(255)
+--echo *     varchar(2)         -->    varchar(2)
+--echo *     varchar(255)       -->    varchar(255)
+--echo *     varchar(1024)      -->    varchar(1024)
+--echo *     varbinary(2)       -->    varbinary(2)
+--echo *     varbinary(255)     -->    varbinary(255)
+--echo *     varbinary(1024)    -->    varbinary(1024)
+--echo ************************************************************
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t2_myisam ENGINE=MYISAM AS SELECT * FROM t2;
+
+# restore table
+DELETE FROM t2;
+# for debugging:
+#    --exec $NDB_RESTORE --no-defaults -b $the_backup_id -n 1 -L -r --print $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT
+#    --exec $NDB_RESTORE --no-defaults -b $the_backup_id -n 2 -L -r --print $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $restore_cmd -n 1 --print -L > /dev/null
+--exec $restore_cmd -n 2 --print -L > /dev/null
+SELECT
+  length(c1), length(c2), length(c3),
+  length(b1), length(b2), length(b2),
+  length(vc1), length(vc2), length(vc3),
+  length(vb1), length(vb2), length(vb3)
+FROM t2;
+
+# verify data
+SELECT COUNT(*) FROM t2 NATURAL JOIN t2_myisam;
+DROP TABLE t2_myisam;
+
+--echo ************************************************************
+--echo * Restoring table with 1st degree demoted char+binary types:
+--echo *     char(2)            -->    char(1)
+--echo *     char(128)          -->    char(2)
+--echo *     char(255)          -->    char(128)
+--echo *     binary(2)          -->    binary(1)
+--echo *     binary(128)        -->    binary(2)
+--echo *     binary(255)        -->    binary(128)
+--echo *     varchar(2)         -->    varchar(1)
+--echo *     varchar(255)       -->    varchar(2)
+--echo *     varchar(1024)      -->    varchar(512)
+--echo *     varbinary(2)       -->    varbinary(1)
+--echo *     varbinary(255)     -->    varbinary(2)
+--echo *     varbinary(1024)    -->    varbinary(512)
+--echo ************************************************************
+
+# demote char+binary type attibutes
+--disable_warnings
+ALTER TABLE t2
+  modify c1 char(1), modify c2 char(2), modify c3 char(128),
+  modify b1 binary(1), modify b2 binary(2), modify b3 binary(128),
+  modify vc1 varchar(1), modify vc2 varchar(2), modify vc3 varchar(512),
+  modify vb1 varbinary(1), modify vb2 varbinary(2), modify vb3 varbinary(512);
+--enable_warnings
+SELECT
+  length(c1), length(c2), length(c3),
+  length(b1), length(b2), length(b2),
+  length(vc1), length(vc2), length(vc3),
+  length(vb1), length(vb2), length(vb3)
+FROM t2;
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t2_myisam ENGINE=MYISAM AS SELECT * FROM t2;
+
+# restore table
+DELETE FROM t2;
+--exec $restore_cmd -n 1 --print -L > /dev/null
+--exec $restore_cmd -n 2 --print -L > /dev/null
+SELECT
+  length(c1), length(c2), length(c3),
+  length(b1), length(b2), length(b2),
+  length(vc1), length(vc2), length(vc3),
+  length(vb1), length(vb2), length(vb3)
+FROM t2;
+
+# verify data
+SELECT COUNT(*) FROM t2 NATURAL JOIN t2_myisam;
+DROP TABLE t2_myisam;
+
+--echo ************************************************************
+--echo * Restoring table with 2nd degree demoted char+binary types:
+--echo *     char(2)            -->    char(1)
+--echo *     char(128)          -->    char(1)
+--echo *     char(255)          -->    char(2)
+--echo *     binary(2)          -->    binary(1)
+--echo *     binary(128)        -->    binary(1)
+--echo *     binary(255)        -->    binary(2)
+--echo *     varchar(2)         -->    varchar(1)
+--echo *     varchar(255)       -->    varchar(1)
+--echo *     varchar(1024)      -->    varchar(255)
+--echo *     varbinary(2)       -->    varbinary(1)
+--echo *     varbinary(255)     -->    varbinary(1)
+--echo *     varbinary(1024)    -->    varbinary(255)
+--echo ************************************************************
+
+# demote char+binary type attibutes
+--disable_warnings
+ALTER TABLE t2
+  modify c1 char(1), modify c2 char(1), modify c3 char(2),
+  modify b1 binary(1), modify b2 binary(1), modify b3 binary(2),
+  modify vc1 varchar(1), modify vc2 varchar(1), modify vc3 varchar(255),
+  modify vb1 varbinary(1), modify vb2 varbinary(1), modify vb3 varbinary(255);
+--enable_warnings
+SELECT
+  length(c1), length(c2), length(c3),
+  length(b1), length(b2), length(b2),
+  length(vc1), length(vc2), length(vc3),
+  length(vb1), length(vb2), length(vb3)
+FROM t2;
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t2_myisam ENGINE=MYISAM AS SELECT * FROM t2;
+
+# restore table
+DELETE FROM t2;
+--exec $restore_cmd -n 1 --print -L > /dev/null
+--exec $restore_cmd -n 2 --print -L > /dev/null
+SELECT
+  length(c1), length(c2), length(c3),
+  length(b1), length(b2), length(b2),
+  length(vc1), length(vc2), length(vc3),
+  length(vb1), length(vb2), length(vb3)
+FROM t2;
+
+# verify data
+SELECT COUNT(*) FROM t2 NATURAL JOIN t2_myisam;
+DROP TABLE t2_myisam;
+
+--echo ************************************************************
+--echo * Restoring table with 3rd degree demoted char+binary types:
+--echo *     char(2)            -->    char(1)
+--echo *     char(128)          -->    char(1)
+--echo *     char(255)          -->    char(1)
+--echo *     binary(2)          -->    binary(1)
+--echo *     binary(128)        -->    binary(1)
+--echo *     binary(255)        -->    binary(1)
+--echo *     varchar(2)         -->    varchar(1)
+--echo *     varchar(255)       -->    varchar(1)
+--echo *     varchar(1024)      -->    varchar(1)
+--echo *     varbinary(2)       -->    varbinary(1)
+--echo *     varbinary(255)     -->    varbinary(1)
+--echo *     varbinary(1024)    -->    varbinary(1)
+--echo ************************************************************
+
+# demote char+binary type attibutes
+--disable_warnings
+ALTER TABLE t2
+  modify c1 char(1), modify c2 char(1), modify c3 char(1),
+  modify b1 binary(1), modify b2 binary(1), modify b3 binary(1),
+  modify vc1 varchar(1), modify vc2 varchar(1), modify vc3 varchar(1),
+  modify vb1 varbinary(1), modify vb2 varbinary(1), modify vb3 varbinary(1);
+--enable_warnings
+SELECT
+  length(c1), length(c2), length(c3),
+  length(b1), length(b2), length(b2),
+  length(vc1), length(vc2), length(vc3),
+  length(vb1), length(vb2), length(vb3)
+FROM t2;
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t2_myisam ENGINE=MYISAM AS SELECT * FROM t2;
+
+# restore table
+DELETE FROM t2;
+--exec $restore_cmd -n 1 --print -L > /dev/null
+--exec $restore_cmd -n 2 --print -L > /dev/null
+SELECT
+  length(c1), length(c2), length(c3),
+  length(b1), length(b2), length(b2),
+  length(vc1), length(vc2), length(vc3),
+  length(vb1), length(vb2), length(vb3)
+FROM t2;
+
+# verify data
+SELECT COUNT(*) FROM t2 NATURAL JOIN t2_myisam;
+DROP TABLE t2_myisam;
+
+--echo ************************************************************
+--echo * Restoring table with changed var-ness of char+binary types:
+--echo *     char(2)            -->    varchar(2)
+--echo *     char(128)          -->    varchar(128)
+--echo *     char(255)          -->    varchar(255)
+--echo *     binary(2)          -->    varbinary(2)
+--echo *     binary(128)        -->    varbinary(128)
+--echo *     binary(255)        -->    varbinary(255)
+--echo *     varchar(2)         -->    char(2)
+--echo *     varchar(255)       -->    char(255)
+--echo *     varchar(1024)      -->    varchar(1024)
+--echo *     varbinary(2)       -->    binary(2)
+--echo *     varbinary(255)     -->    binary(255)
+--echo *     varbinary(1024)    -->    varbinary(1024)
+--echo ************************************************************
+
+# demote char+binary type attibutes
+--disable_warnings
+DELETE FROM t2;
+ALTER TABLE t2
+  modify c1 varchar(2), modify c2 varchar(128), modify c3 varchar(255),
+  modify b1 varbinary(2), modify b2 varbinary(128), modify b3 varbinary(255),
+  modify vc1 char(2), modify vc2 char(255), modify vc3 varchar(1024),
+  modify vb1 binary(2), modify vb2 binary(255), modify vb3 varbinary(1024);
+INSERT INTO t2 VALUES(
+  repeat('a', 2), repeat('b', 128), repeat('c', 255),
+  repeat('d', 2), repeat('e', 128), repeat('f', 255),
+  repeat('g', 2), repeat('h', 255), repeat('i', 1024),
+  repeat('j', 2), repeat('k', 255), repeat('l', 1024)
+);
+--enable_warnings
+SELECT
+  length(c1), length(c2), length(c3),
+  length(b1), length(b2), length(b2),
+  length(vc1), length(vc2), length(vc3),
+  length(vb1), length(vb2), length(vb3)
+FROM t2;
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t2_myisam ENGINE=MYISAM AS SELECT * FROM t2;
+
+# restore table
+DELETE FROM t2;
+--exec $restore_cmd -n 1 --print -A > /dev/null
+--exec $restore_cmd -n 2 --print -A > /dev/null
+SELECT
+  length(c1), length(c2), length(c3),
+  length(b1), length(b2), length(b2),
+  length(vc1), length(vc2), length(vc3),
+  length(vb1), length(vb2), length(vb3)
+FROM t2;
+
+# verify data
+SELECT COUNT(*) FROM t2 NATURAL JOIN t2_myisam;
+DROP TABLE t2_myisam;
+
+--echo ************************************************************
+--echo * Restoring table with changed varness + 1st degree demoted types:
+--echo *     char(2)            -->    varchar(1)
+--echo *     char(128)          -->    varchar(2)
+--echo *     char(255)          -->    varchar(128)
+--echo *     binary(2)          -->    varbinary(1)
+--echo *     binary(128)        -->    varbinary(2)
+--echo *     binary(255)        -->    varbinary(128)
+--echo *     varchar(2)         -->    char(1)
+--echo *     varchar(255)       -->    char(2)
+--echo *     varchar(1024)      -->    char(255)
+--echo *     varbinary(2)       -->    binary(1)
+--echo *     varbinary(255)     -->    binary(2)
+--echo *     varbinary(1024)    -->    binary(255)
+--echo ************************************************************
+
+# demote char+binary type attibutes
+--disable_warnings
+DELETE FROM t2;
+ALTER TABLE t2
+  modify c1 varchar(1), modify c2 varchar(2), modify c3 varchar(128),
+  modify b1 varbinary(1), modify b2 varbinary(2), modify b3 varbinary(128),
+  modify vc1 char(1), modify vc2 char(2), modify vc3 char(255),
+  modify vb1 binary(1), modify vb2 binary(2), modify vb3 binary(255);
+INSERT INTO t2 VALUES(
+  repeat('a', 2), repeat('b', 128), repeat('c', 255),
+  repeat('d', 2), repeat('e', 128), repeat('f', 255),
+  repeat('g', 2), repeat('h', 255), repeat('i', 1024),
+  repeat('j', 2), repeat('k', 255), repeat('l', 1024)
+);
+--enable_warnings
+SELECT
+  length(c1), length(c2), length(c3),
+  length(b1), length(b2), length(b2),
+  length(vc1), length(vc2), length(vc3),
+  length(vb1), length(vb2), length(vb3)
+FROM t2;
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t2_myisam ENGINE=MYISAM AS SELECT * FROM t2;
+
+# restore table
+DELETE FROM t2;
+--exec $restore_cmd -n 1 --print -L > /dev/null
+--exec $restore_cmd -n 2 --print -L > /dev/null
+SELECT
+  length(c1), length(c2), length(c3),
+  length(b1), length(b2), length(b2),
+  length(vc1), length(vc2), length(vc3),
+  length(vb1), length(vb2), length(vb3)
+FROM t2;
+
+# verify data
+SELECT COUNT(*) FROM t2 NATURAL JOIN t2_myisam;
+DROP TABLE t2_myisam;
+
+--echo ************************************************************
+--echo * Restoring table with changed varness + 2nd degree demoted types:
+--echo *     char(2)            -->    varchar(1)
+--echo *     char(128)          -->    varchar(1)
+--echo *     char(255)          -->    varchar(2)
+--echo *     binary(2)          -->    varbinary(1)
+--echo *     binary(128)        -->    varbinary(1)
+--echo *     binary(255)        -->    varbinary(2)
+--echo *     varchar(2)         -->    char(1)
+--echo *     varchar(255)       -->    char(1)
+--echo *     varchar(1024)      -->    char(255)
+--echo *     varbinary(2)       -->    binary(1)
+--echo *     varbinary(255)     -->    binary(1)
+--echo *     varbinary(1024)    -->    binary(255)
+--echo ************************************************************
+
+# demote char+binary type attibutes
+--disable_warnings
+DELETE FROM t2;
+ALTER TABLE t2
+  modify c1 varchar(1), modify c2 varchar(1), modify c3 varchar(2),
+  modify b1 varbinary(1), modify b2 varbinary(1), modify b3 varbinary(2),
+  modify vc1 char(1), modify vc2 char(1), modify vc3 char(255),
+  modify vb1 binary(1), modify vb2 binary(1), modify vb3 binary(255);
+INSERT INTO t2 VALUES(
+  repeat('a', 2), repeat('b', 128), repeat('c', 255),
+  repeat('d', 2), repeat('e', 128), repeat('f', 255),
+  repeat('g', 2), repeat('h', 255), repeat('i', 1024),
+  repeat('j', 2), repeat('k', 255), repeat('l', 1024)
+);
+--enable_warnings
+SELECT
+  length(c1), length(c2), length(c3),
+  length(b1), length(b2), length(b2),
+  length(vc1), length(vc2), length(vc3),
+  length(vb1), length(vb2), length(vb3)
+FROM t2;
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t2_myisam ENGINE=MYISAM AS SELECT * FROM t2;
+
+# restore table
+DELETE FROM t2;
+--exec $restore_cmd -n 1 --print -L > /dev/null
+--exec $restore_cmd -n 2 --print -L > /dev/null
+SELECT
+  length(c1), length(c2), length(c3),
+  length(b1), length(b2), length(b2),
+  length(vc1), length(vc2), length(vc3),
+  length(vb1), length(vb2), length(vb3)
+FROM t2;
+
+# verify data
+SELECT COUNT(*) FROM t2 NATURAL JOIN t2_myisam;
+DROP TABLE t2_myisam;
+
+--echo ************************************************************
+--echo * Restoring table with changed varness + 3rd degree demoted types:
+--echo *     char(2)            -->    varchar(1)
+--echo *     char(128)          -->    varchar(1)
+--echo *     char(255)          -->    varchar(1)
+--echo *     binary(2)          -->    varbinary(1)
+--echo *     binary(128)        -->    varbinary(1)
+--echo *     binary(255)        -->    varbinary(1)
+--echo *     varchar(2)         -->    char(1)
+--echo *     varchar(255)       -->    char(1)
+--echo *     varchar(1024)      -->    char(1)
+--echo *     varbinary(2)       -->    binary(1)
+--echo *     varbinary(255)     -->    binary(1)
+--echo *     varbinary(1024)    -->    binary(1)
+--echo ************************************************************
+
+# demote char+binary type attibutes
+--disable_warnings
+DELETE FROM t2;
+ALTER TABLE t2
+  modify c1 varchar(1), modify c2 varchar(1), modify c3 varchar(1),
+  modify b1 varbinary(1), modify b2 varbinary(1), modify b3 varbinary(1),
+  modify vc1 char(1), modify vc2 char(1), modify vc3 char(1),
+  modify vb1 binary(1), modify vb2 binary(1), modify vb3 binary(1);
+INSERT INTO t2 VALUES(
+  repeat('a', 2), repeat('b', 128), repeat('c', 255),
+  repeat('d', 2), repeat('e', 128), repeat('f', 255),
+  repeat('g', 2), repeat('h', 255), repeat('i', 1024),
+  repeat('j', 2), repeat('k', 255), repeat('l', 1024)
+);
+--enable_warnings
+SELECT
+  length(c1), length(c2), length(c3),
+  length(b1), length(b2), length(b2),
+  length(vc1), length(vc2), length(vc3),
+  length(vb1), length(vb2), length(vb3)
+FROM t2;
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t2_myisam ENGINE=MYISAM AS SELECT * FROM t2;
+
+# restore table
+DELETE FROM t2;
+--exec $restore_cmd -n 1 --print -L > /dev/null
+--exec $restore_cmd -n 2 --print -L > /dev/null
+SELECT
+  length(c1), length(c2), length(c3),
+  length(b1), length(b2), length(b2),
+  length(vc1), length(vc2), length(vc3),
+  length(vb1), length(vb2), length(vb3)
+FROM t2;
+
+# verify data
+SELECT COUNT(*) FROM t2 NATURAL JOIN t2_myisam;
+DROP TABLE t2_myisam;
+
+--echo ************************************************************
+--echo * Deleting table with char+binary types
+--echo ************************************************************
+
+DROP TABLE t2;

=== added file 'mysql-test/suite/ndb/t/ndb_restore_lossy_integral_conv.test'
--- a/mysql-test/suite/ndb/t/ndb_restore_lossy_integral_conv.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/t/ndb_restore_lossy_integral_conv.test	2010-10-22 05:47:04 +0000
@@ -0,0 +1,575 @@
+######################################################################
+# Author: Martin Zaun
+# Date: 2010-10
+# Purpose: Lossy conversion test for integral types
+######################################################################
+
+-- source include/have_ndb.inc
+
+# mysqld's configuration is not relevant to this test
+-- source include/not_embedded.inc
+
+--echo ************************************************************
+--echo * Creating table with integral types
+--echo ************************************************************
+
+CREATE TABLE t1(
+  t1 tinyint,  t2 tinyint,  ut1 tinyint unsigned,
+  s1 smallint,  s2 smallint,  us1 smallint unsigned,
+  m1 mediumint,  m2 mediumint,  um1 mediumint unsigned,
+  i1 int,  i2 int,  ui1 int unsigned,
+  b1 bigint,  b2 bigint,  ub1 bigint unsigned
+) ENGINE=NDB;
+
+INSERT INTO t1 VALUES(
+  -128, 127, 255,
+  -32768, 32767, 65535,
+  -8388608, 8388607, 16777215,
+  -2147483648, 2147483647, 4294967295,
+  -9223372036854775808, 9223372036854775807, 18446744073709551615
+);
+
+--echo ************************************************************
+--echo * Backing up table with integral types
+--echo ************************************************************
+
+--source include/ndb_backup.inc
+
+# command shortcuts
+#--let $restore_cmd=$NDB_RESTORE --no-defaults -b $the_backup_id -r
+#--let $restore_cmd=$restore_cmd --backup_path=$NDB_BACKUPS-$the_backup_id
+# for ndb 6.3:
+--let $restore_cmd=$NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id
+--let $restore_cmd=$restore_cmd -r --backup_path=$NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id
+
+--echo ************************************************************
+--echo * Restoring table with unchanged integral types:
+--echo *     tinyint[unsigned]  -->    tinyint[unsigned]
+--echo *    smallint[unsigned]  -->   smallint[unsigned]
+--echo *   mediumint[unsigned]  -->  mediumint[unsigned]
+--echo *         int[unsigned]  -->        int[unsigned]
+--echo *      bigint[unsigned]  -->     bigint[unsigned]
+--echo ************************************************************
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1;
+
+# restore table
+DELETE FROM t1;
+# for debugging:
+#    --exec $NDB_RESTORE --no-defaults -b $the_backup_id -n 1 -L -r --print $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT
+#    --exec $NDB_RESTORE --no-defaults -b $the_backup_id -n 2 -L -r --print $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $restore_cmd -n 1 --print -L > /dev/null
+--exec $restore_cmd -n 2 --print -L > /dev/null
+SELECT * FROM t1;
+
+# verify data
+SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam;
+DROP TABLE t1_myisam;
+
+--echo ************************************************************
+--echo * Restoring table with 1st degree demoted integral types:
+--echo *     tinyint[unsigned]  -->    tinyint[unsigned]
+--echo *    smallint[unsigned]  -->    tinyint[unsigned]
+--echo *   mediumint[unsigned]  -->   smallint[unsigned]
+--echo *         int[unsigned]  -->  mediumint[unsigned]
+--echo *      bigint[unsigned]  -->        int[unsigned]
+--echo ************************************************************
+
+# demote integral type attibutes
+--disable_warnings
+ALTER TABLE t1
+  modify t1 tinyint,  modify t2 tinyint,  modify ut1 tinyint unsigned,
+  modify s1 tinyint,  modify s2 tinyint,  modify us1 tinyint unsigned,
+  modify m1 smallint,  modify m2 smallint,  modify um1 smallint unsigned,
+  modify i1 mediumint,  modify i2 mediumint,  modify ui1 mediumint unsigned,
+  modify b1 int,  modify b2 int,  modify ub1 int unsigned;
+--enable_warnings
+SELECT * FROM t1;
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1;
+
+# restore table
+DELETE FROM t1;
+--exec $restore_cmd -n 1 --print -L > /dev/null
+--exec $restore_cmd -n 2 --print -L > /dev/null
+SELECT * FROM t1;
+
+# verify data
+SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam;
+DROP TABLE t1_myisam;
+
+--echo ************************************************************
+--echo * Restoring table with 2nd degree demoted integral types:
+--echo *     tinyint[unsigned]  -->    tinyint[unsigned]
+--echo *    smallint[unsigned]  -->    tinyint[unsigned]
+--echo *   mediumint[unsigned]  -->    tinyint[unsigned]
+--echo *         int[unsigned]  -->   smallint[unsigned]
+--echo *      bigint[unsigned]  -->  mediumint[unsigned]
+--echo ************************************************************
+
+# demote integral type attibutes
+--disable_warnings
+ALTER TABLE t1
+  modify t1 tinyint,  modify t2 tinyint,  modify ut1 tinyint unsigned,
+  modify s1 tinyint,  modify s2 tinyint,  modify us1 tinyint unsigned,
+  modify m1 tinyint,  modify m2 tinyint,  modify um1 tinyint unsigned,
+  modify i1 smallint,  modify i2 smallint,  modify ui1 smallint unsigned,
+  modify b1 mediumint,  modify b2 mediumint,  modify ub1 mediumint unsigned;
+--enable_warnings
+SELECT * FROM t1;
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1;
+
+# restore table
+DELETE FROM t1;
+--exec $restore_cmd -n 1 --print -L > /dev/null
+--exec $restore_cmd -n 2 --print -L > /dev/null
+SELECT * FROM t1;
+
+# verify data
+SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam;
+DROP TABLE t1_myisam;
+
+--echo ************************************************************
+--echo * Restoring table with 3rd degree demoted integral types:
+--echo *     tinyint[unsigned]  -->    tinyint[unsigned]
+--echo *    smallint[unsigned]  -->    tinyint[unsigned]
+--echo *   mediumint[unsigned]  -->    tinyint[unsigned]
+--echo *         int[unsigned]  -->    tinyint[unsigned]
+--echo *      bigint[unsigned]  -->   smallint[unsigned]
+--echo ************************************************************
+
+# demote integral type attibutes
+--disable_warnings
+ALTER TABLE t1
+  modify t1 tinyint,  modify t2 tinyint,  modify ut1 tinyint unsigned,
+  modify s1 tinyint,  modify s2 tinyint,  modify us1 tinyint unsigned,
+  modify m1 tinyint,  modify m2 tinyint,  modify um1 tinyint unsigned,
+  modify i1 tinyint,  modify i2 tinyint,  modify ui1 tinyint unsigned,
+  modify b1 smallint,  modify b2 smallint,  modify ub1 smallint unsigned;
+--enable_warnings
+SELECT * FROM t1;
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1;
+
+# restore table
+DELETE FROM t1;
+--exec $restore_cmd -n 1 --print -L > /dev/null
+--exec $restore_cmd -n 2 --print -L > /dev/null
+SELECT * FROM t1;
+
+# verify data
+SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam;
+DROP TABLE t1_myisam;
+
+--echo ************************************************************
+--echo * Restoring table with 4th degree demoted integral types:
+--echo *     tinyint[unsigned]  -->    tinyint[unsigned]
+--echo *    smallint[unsigned]  -->    tinyint[unsigned]
+--echo *   mediumint[unsigned]  -->    tinyint[unsigned]
+--echo *         int[unsigned]  -->    tinyint[unsigned]
+--echo *      bigint[unsigned]  -->    tinyint[unsigned]
+--echo ************************************************************
+
+# demote integral type attibutes
+--disable_warnings
+ALTER TABLE t1
+  modify t1 tinyint,  modify t2 tinyint,  modify ut1 tinyint unsigned,
+  modify s1 tinyint,  modify s2 tinyint,  modify us1 tinyint unsigned,
+  modify m1 tinyint,  modify m2 tinyint,  modify um1 tinyint unsigned,
+  modify i1 tinyint,  modify i2 tinyint,  modify ui1 tinyint unsigned,
+  modify b1 tinyint,  modify b2 tinyint,  modify ub1 tinyint unsigned;
+--enable_warnings
+SELECT * FROM t1;
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1;
+
+# restore table
+DELETE FROM t1;
+--exec $restore_cmd -n 1 --print -L > /dev/null
+--exec $restore_cmd -n 2 --print -L > /dev/null
+SELECT * FROM t1;
+
+# verify data
+SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam;
+DROP TABLE t1_myisam;
+
+--echo ************************************************************
+--echo * Restoring table with changed signedness:
+--echo *     tinyint unsigned/signed  -->    tinyint signed/unsigned
+--echo *    smallint unsigned/signed  -->   smallint signed/unsigned
+--echo *   mediumint unsigned/signed  -->  mediumint signed/unsigned
+--echo *         int unsigned/signed  -->        int signed/unsigned
+--echo *      bigint unsigned/signed  -->     bigint signed/unsigned
+--echo ************************************************************
+
+# convert signedness of integral type attibutes
+--disable_warnings
+DELETE FROM t1;
+ALTER TABLE t1
+  modify t1 tinyint unsigned,  modify t2 tinyint unsigned,  modify ut1 tinyint signed,
+  modify s1 smallint unsigned,  modify s2 smallint unsigned,  modify us1 smallint signed,
+  modify m1 mediumint unsigned,  modify m2 mediumint unsigned,  modify um1 mediumint signed,
+  modify i1 int unsigned,  modify i2 int unsigned,  modify ui1 int signed,
+  modify b1 bigint unsigned,  modify b2 bigint unsigned,  modify ub1 bigint signed;
+INSERT INTO t1 VALUES(
+  -128, 127, 255,
+  -32768, 32767, 65535,
+  -8388608, 8388607, 16777215,
+  -2147483648, 2147483647, 4294967295,
+  -9223372036854775808, 9223372036854775807, 18446744073709551615
+);
+--enable_warnings
+SELECT * FROM t1;
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1;
+
+# restore table
+DELETE FROM t1;
+--exec $restore_cmd -n 1 --print -L > /dev/null
+--exec $restore_cmd -n 2 --print -L > /dev/null
+SELECT * FROM t1;
+
+# verify data
+SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam;
+DROP TABLE t1_myisam;
+
+--echo ************************************************************
+--echo * Restoring table with changed signedness + 1st degree promoted types:
+--echo *     tinyint unsigned/signed  -->   smallint signed/unsigned
+--echo *    smallint unsigned/signed  -->  mediumint signed/unsigned
+--echo *   mediumint unsigned/signed  -->        int signed/unsigned
+--echo *         int unsigned/signed  -->     bigint signed/unsigned
+--echo *      bigint unsigned/signed  -->     bigint signed/unsigned
+--echo ************************************************************
+
+# convert signedness of integral type attibutes
+--disable_warnings
+DELETE FROM t1;
+ALTER TABLE t1
+  modify t1 smallint unsigned,  modify t2 smallint unsigned,  modify ut1 smallint signed,
+  modify s1 mediumint unsigned,  modify s2 mediumint unsigned,  modify us1 mediumint signed,
+  modify m1 int unsigned,  modify m2 int unsigned,  modify um1 int signed,
+  modify i1 bigint unsigned,  modify i2 bigint unsigned,  modify ui1 bigint signed,
+  modify b1 bigint unsigned,  modify b2 bigint unsigned,  modify ub1 bigint signed;
+INSERT INTO t1 VALUES(
+  -128, 127, 255,
+  -32768, 32767, 65535,
+  -8388608, 8388607, 16777215,
+  -2147483648, 2147483647, 4294967295,
+  -9223372036854775808, 9223372036854775807, 18446744073709551615
+);
+--enable_warnings
+SELECT * FROM t1;
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1;
+
+# restore table
+DELETE FROM t1;
+--exec $restore_cmd -n 1 --print -L > /dev/null
+--exec $restore_cmd -n 2 --print -L > /dev/null
+SELECT * FROM t1;
+
+# verify data
+SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam;
+DROP TABLE t1_myisam;
+
+--echo ************************************************************
+--echo * Restoring table with changed signedness + 2nd degree promoted types:
+--echo *     tinyint unsigned/signed  -->  mediumint signed/unsigned
+--echo *    smallint unsigned/signed  -->        int signed/unsigned
+--echo *   mediumint unsigned/signed  -->     bigint signed/unsigned
+--echo *         int unsigned/signed  -->     bigint signed/unsigned
+--echo *      bigint unsigned/signed  -->     bigint signed/unsigned
+--echo ************************************************************
+
+# convert signedness of integral type attibutes
+--disable_warnings
+DELETE FROM t1;
+ALTER TABLE t1
+  modify t1 mediumint unsigned,  modify t2 mediumint unsigned,  modify ut1 mediumint signed,
+  modify s1 int unsigned,  modify s2 int unsigned,  modify us1 int signed,
+  modify m1 bigint unsigned,  modify m2 bigint unsigned,  modify um1 bigint signed,
+  modify i1 bigint unsigned,  modify i2 bigint unsigned,  modify ui1 bigint signed,
+  modify b1 bigint unsigned,  modify b2 bigint unsigned,  modify ub1 bigint signed;
+INSERT INTO t1 VALUES(
+  -128, 127, 255,
+  -32768, 32767, 65535,
+  -8388608, 8388607, 16777215,
+  -2147483648, 2147483647, 4294967295,
+  -9223372036854775808, 9223372036854775807, 18446744073709551615
+);
+--enable_warnings
+SELECT * FROM t1;
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1;
+
+# restore table
+DELETE FROM t1;
+--exec $restore_cmd -n 1 --print -L > /dev/null
+--exec $restore_cmd -n 2 --print -L > /dev/null
+SELECT * FROM t1;
+
+# verify data
+SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam;
+DROP TABLE t1_myisam;
+
+--echo ************************************************************
+--echo * Restoring table with changed signedness + 3rd degree promoted types:
+--echo *     tinyint unsigned/signed  -->        int signed/unsigned
+--echo *    smallint unsigned/signed  -->     bigint signed/unsigned
+--echo *   mediumint unsigned/signed  -->     bigint signed/unsigned
+--echo *         int unsigned/signed  -->     bigint signed/unsigned
+--echo *      bigint unsigned/signed  -->     bigint signed/unsigned
+--echo ************************************************************
+
+# convert signedness of integral type attibutes
+--disable_warnings
+DELETE FROM t1;
+ALTER TABLE t1
+  modify t1 int unsigned,  modify t2 int unsigned,  modify ut1 int signed,
+  modify s1 bigint unsigned,  modify s2 bigint unsigned,  modify us1 bigint signed,
+  modify m1 bigint unsigned,  modify m2 bigint unsigned,  modify um1 bigint signed,
+  modify i1 bigint unsigned,  modify i2 bigint unsigned,  modify ui1 bigint signed,
+  modify b1 bigint unsigned,  modify b2 bigint unsigned,  modify ub1 bigint signed;
+INSERT INTO t1 VALUES(
+  -128, 127, 255,
+  -32768, 32767, 65535,
+  -8388608, 8388607, 16777215,
+  -2147483648, 2147483647, 4294967295,
+  -9223372036854775808, 9223372036854775807, 18446744073709551615
+);
+--enable_warnings
+SELECT * FROM t1;
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1;
+
+# restore table
+DELETE FROM t1;
+--exec $restore_cmd -n 1 --print -L > /dev/null
+--exec $restore_cmd -n 2 --print -L > /dev/null
+SELECT * FROM t1;
+
+# verify data
+SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam;
+DROP TABLE t1_myisam;
+
+--echo ************************************************************
+--echo * Restoring table with changed signedness + 4th degree promoted types:
+--echo *     tinyint unsigned/signed  -->     bigint signed/unsigned
+--echo *    smallint unsigned/signed  -->     bigint signed/unsigned
+--echo *   mediumint unsigned/signed  -->     bigint signed/unsigned
+--echo *         int unsigned/signed  -->     bigint signed/unsigned
+--echo *      bigint unsigned/signed  -->     bigint signed/unsigned
+--echo ************************************************************
+
+# convert signedness of integral type attibutes
+--disable_warnings
+DELETE FROM t1;
+ALTER TABLE t1
+  modify t1 bigint unsigned,  modify t2 bigint unsigned,  modify ut1 bigint signed,
+  modify s1 bigint unsigned,  modify s2 bigint unsigned,  modify us1 bigint signed,
+  modify m1 bigint unsigned,  modify m2 bigint unsigned,  modify um1 bigint signed,
+  modify i1 bigint unsigned,  modify i2 bigint unsigned,  modify ui1 bigint signed,
+  modify b1 bigint unsigned,  modify b2 bigint unsigned,  modify ub1 bigint signed;
+INSERT INTO t1 VALUES(
+  -128, 127, 255,
+  -32768, 32767, 65535,
+  -8388608, 8388607, 16777215,
+  -2147483648, 2147483647, 4294967295,
+  -9223372036854775808, 9223372036854775807, 18446744073709551615
+);
+--enable_warnings
+SELECT * FROM t1;
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1;
+
+# restore table
+DELETE FROM t1;
+--exec $restore_cmd -n 1 --print -L > /dev/null
+--exec $restore_cmd -n 2 --print -L > /dev/null
+SELECT * FROM t1;
+
+# verify data
+SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam;
+DROP TABLE t1_myisam;
+
+--echo ************************************************************
+--echo * Restoring table with changed signedness + 1st degree demoted types:
+--echo *     tinyint unsigned/signed  -->    tinyint signed/unsigned
+--echo *    smallint unsigned/signed  -->    tinyint signed/unsigned
+--echo *   mediumint unsigned/signed  -->   smallint signed/unsigned
+--echo *         int unsigned/signed  -->  mediumint signed/unsigned
+--echo *      bigint unsigned/signed  -->        int signed/unsigned
+--echo ************************************************************
+
+# convert signedness of integral type attibutes
+--disable_warnings
+DELETE FROM t1;
+ALTER TABLE t1
+  modify t1 tinyint unsigned,  modify t2 tinyint unsigned,  modify ut1 tinyint signed,
+  modify s1 tinyint unsigned,  modify s2 tinyint unsigned,  modify us1 tinyint signed,
+  modify m1 smallint unsigned,  modify m2 smallint unsigned,  modify um1 smallint signed,
+  modify i1 mediumint unsigned,  modify i2 mediumint unsigned,  modify ui1 mediumint signed,
+  modify b1 int unsigned,  modify b2 int unsigned,  modify ub1 int signed;
+INSERT INTO t1 VALUES(
+  -128, 127, 255,
+  -32768, 32767, 65535,
+  -8388608, 8388607, 16777215,
+  -2147483648, 2147483647, 4294967295,
+  -9223372036854775808, 9223372036854775807, 18446744073709551615
+);
+--enable_warnings
+SELECT * FROM t1;
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1;
+
+# restore table
+DELETE FROM t1;
+--exec $restore_cmd -n 1 --print -L > /dev/null
+--exec $restore_cmd -n 2 --print -L > /dev/null
+SELECT * FROM t1;
+
+# verify data
+SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam;
+DROP TABLE t1_myisam;
+
+--echo ************************************************************
+--echo * Restoring table with changed signedness + 2nd degree demoted types:
+--echo *     tinyint unsigned/signed  -->    tinyint signed/unsigned
+--echo *    smallint unsigned/signed  -->    tinyint signed/unsigned
+--echo *   mediumint unsigned/signed  -->    tinyint signed/unsigned
+--echo *         int unsigned/signed  -->   smallint signed/unsigned
+--echo *      bigint unsigned/signed  -->  mediumint signed/unsigned
+--echo ************************************************************
+
+# convert signedness of integral type attibutes
+--disable_warnings
+DELETE FROM t1;
+ALTER TABLE t1
+  modify t1 tinyint unsigned,  modify t2 tinyint unsigned,  modify ut1 tinyint signed,
+  modify s1 tinyint unsigned,  modify s2 tinyint unsigned,  modify us1 tinyint signed,
+  modify m1 tinyint unsigned,  modify m2 tinyint unsigned,  modify um1 tinyint signed,
+  modify i1 smallint unsigned,  modify i2 smallint unsigned,  modify ui1 smallint signed,
+  modify b1 mediumint unsigned,  modify b2 mediumint unsigned,  modify ub1 mediumint signed;
+INSERT INTO t1 VALUES(
+  -128, 127, 255,
+  -32768, 32767, 65535,
+  -8388608, 8388607, 16777215,
+  -2147483648, 2147483647, 4294967295,
+  -9223372036854775808, 9223372036854775807, 18446744073709551615
+);
+--enable_warnings
+SELECT * FROM t1;
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1;
+
+# restore table
+DELETE FROM t1;
+--exec $restore_cmd -n 1 --print -L > /dev/null
+--exec $restore_cmd -n 2 --print -L > /dev/null
+SELECT * FROM t1;
+
+# verify data
+SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam;
+DROP TABLE t1_myisam;
+
+--echo ************************************************************
+--echo * Restoring table with changed signedness + 3rd degree demoted types:
+--echo *     tinyint unsigned/signed  -->    tinyint signed/unsigned
+--echo *    smallint unsigned/signed  -->    tinyint signed/unsigned
+--echo *   mediumint unsigned/signed  -->    tinyint signed/unsigned
+--echo *         int unsigned/signed  -->    tinyint signed/unsigned
+--echo *      bigint unsigned/signed  -->   smallint signed/unsigned
+--echo ************************************************************
+
+# convert signedness of integral type attibutes
+--disable_warnings
+DELETE FROM t1;
+ALTER TABLE t1
+  modify t1 tinyint unsigned,  modify t2 tinyint unsigned,  modify ut1 tinyint signed,
+  modify s1 tinyint unsigned,  modify s2 tinyint unsigned,  modify us1 tinyint signed,
+  modify m1 tinyint unsigned,  modify m2 tinyint unsigned,  modify um1 tinyint signed,
+  modify i1 tinyint unsigned,  modify i2 tinyint unsigned,  modify ui1 tinyint signed,
+  modify b1 smallint unsigned,  modify b2 smallint unsigned,  modify ub1 smallint signed;
+INSERT INTO t1 VALUES(
+  -128, 127, 255,
+  -32768, 32767, 65535,
+  -8388608, 8388607, 16777215,
+  -2147483648, 2147483647, 4294967295,
+  -9223372036854775808, 9223372036854775807, 18446744073709551615
+);
+--enable_warnings
+SELECT * FROM t1;
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1;
+
+# restore table
+DELETE FROM t1;
+--exec $restore_cmd -n 1 --print -L > /dev/null
+--exec $restore_cmd -n 2 --print -L > /dev/null
+SELECT * FROM t1;
+
+# verify data
+SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam;
+DROP TABLE t1_myisam;
+
+--echo ************************************************************
+--echo * Restoring table with changed signedness + 4th degree demoted types:
+--echo *     tinyint unsigned/signed  -->    tinyint signed/unsigned
+--echo *    smallint unsigned/signed  -->    tinyint signed/unsigned
+--echo *   mediumint unsigned/signed  -->    tinyint signed/unsigned
+--echo *         int unsigned/signed  -->    tinyint signed/unsigned
+--echo *      bigint unsigned/signed  -->    tinyint signed/unsigned
+--echo ************************************************************
+
+# convert signedness of integral type attibutes
+--disable_warnings
+DELETE FROM t1;
+ALTER TABLE t1
+  modify t1 tinyint unsigned,  modify t2 tinyint unsigned,  modify ut1 tinyint signed,
+  modify s1 tinyint unsigned,  modify s2 tinyint unsigned,  modify us1 tinyint signed,
+  modify m1 tinyint unsigned,  modify m2 tinyint unsigned,  modify um1 tinyint signed,
+  modify i1 tinyint unsigned,  modify i2 tinyint unsigned,  modify ui1 tinyint signed,
+  modify b1 tinyint unsigned,  modify b2 tinyint unsigned,  modify ub1 tinyint signed;
+INSERT INTO t1 VALUES(
+  -128, 127, 255,
+  -32768, 32767, 65535,
+  -8388608, 8388607, 16777215,
+  -2147483648, 2147483647, 4294967295,
+  -9223372036854775808, 9223372036854775807, 18446744073709551615
+);
+--enable_warnings
+SELECT * FROM t1;
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1;
+
+# restore table
+DELETE FROM t1;
+--exec $restore_cmd -n 1 --print -L > /dev/null
+--exec $restore_cmd -n 2 --print -L > /dev/null
+SELECT * FROM t1;
+
+# verify data
+SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam;
+DROP TABLE t1_myisam;
+
+--echo ************************************************************
+--echo * Deleting table with integral types
+--echo ************************************************************
+
+DROP TABLE t1;

=== added file 'mysql-test/suite/ndb/t/ndb_restore_padding_preservation.test'
--- a/mysql-test/suite/ndb/t/ndb_restore_padding_preservation.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/t/ndb_restore_padding_preservation.test	2010-10-22 05:47:04 +0000
@@ -0,0 +1,265 @@
+######################################################################
+# Author: Martin Zaun
+# Date: 2010-10
+# Purpose: Right-padding preservation test for char and binary types
+######################################################################
+
+-- source include/have_ndb.inc
+
+# mysqld's configuration is not relevant to this test
+-- source include/not_embedded.inc
+
+--echo ************************************************************
+--echo * Creating table with char+binary types
+--echo ************************************************************
+
+CREATE TABLE t3(
+  c1 char(32),
+  b1 binary(32)
+) ENGINE=NDB;
+
+INSERT INTO t3 VALUES('aaaaaaaa', 'bbbbbbbb');
+SELECT length(c1), length(b1) FROM t3;
+
+--echo ************************************************************
+--echo * Backing up table with char+binary types
+--echo ************************************************************
+
+--source include/ndb_backup.inc
+
+# command shortcuts
+#--let $restore_cmd=$NDB_RESTORE --no-defaults -b $the_backup_id -r
+#--let $restore_cmd=$restore_cmd --backup_path=$NDB_BACKUPS-$the_backup_id
+# for ndb 6.3:
+--let $restore_cmd=$NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id
+--let $restore_cmd=$restore_cmd -r --backup_path=$NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id
+
+--echo ************************************************************
+--echo * Restoring table with unchanged char+binary types (sanity check):
+--echo *     char(32)           -->    char(32)
+--echo *     binary(32)         -->    binary(32)
+--echo ************************************************************
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t3_myisam ENGINE=MYISAM AS SELECT * FROM t3;
+
+# restore table
+DELETE FROM t3;
+# for debugging:
+#    --exec $NDB_RESTORE --no-defaults -b $the_backup_id -n 1 -L -r --print $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT
+#    --exec $NDB_RESTORE --no-defaults -b $the_backup_id -n 2 -L -r --print $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $restore_cmd -n 1 --print > /dev/null
+--exec $restore_cmd -n 2 --print > /dev/null
+SELECT length(c1), length(b1) FROM t3;
+
+# verify data
+SELECT COUNT(*) FROM t3 NATURAL JOIN t3_myisam;
+DROP TABLE t3_myisam;
+
+--echo ************************************************************
+--echo * Restoring table with promoted char+binary types preserving padding:
+--echo *     char(32)           -->    varchar(32)
+--echo *     binary(32)         -->    varbinary(32)
+--echo ************************************************************
+
+# demote char+binary type attibutes
+--disable_warnings
+ALTER TABLE t3 MODIFY c1 varchar(32), MODIFY b1 varbinary(32);
+--enable_warnings
+SELECT length(c1), length(b1) FROM t3;
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t3_myisam ENGINE=MYISAM AS SELECT * FROM t3;
+
+# restore table
+DELETE FROM t3;
+--exec $restore_cmd -n 1 --print -A -P > /dev/null
+--exec $restore_cmd -n 2 --print -A -P > /dev/null
+SELECT length(c1), length(b1) FROM t3;
+
+# verify data
+SELECT COUNT(*) FROM t3 NATURAL JOIN t3_myisam;
+DROP TABLE t3_myisam;
+
+--echo ************************************************************
+--echo * Restoring table with promoted char+binary types preserving padding:
+--echo *     char(32)           -->    varchar(64)
+--echo *     binary(32)         -->    varbinary(64)
+--echo ************************************************************
+
+# demote char+binary type attibutes
+--disable_warnings
+ALTER TABLE t3 MODIFY c1 varchar(64), MODIFY b1 varbinary(64);
+--enable_warnings
+SELECT length(c1), length(b1) FROM t3;
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t3_myisam ENGINE=MYISAM AS SELECT * FROM t3;
+
+# restore table
+DELETE FROM t3;
+--exec $restore_cmd -n 1 --print -A -P > /dev/null
+--exec $restore_cmd -n 2 --print -A -P > /dev/null
+SELECT length(c1), length(b1) FROM t3;
+
+# verify data
+SELECT COUNT(*) FROM t3 NATURAL JOIN t3_myisam;
+DROP TABLE t3_myisam;
+
+--echo ************************************************************
+--echo * Restoring table with promoted char+binary types preserving padding:
+--echo *     char(32)           -->    varchar(512)
+--echo *     binary(32)         -->    varbinary(512)
+--echo ************************************************************
+
+# demote char+binary type attibutes
+--disable_warnings
+ALTER TABLE t3 MODIFY c1 varchar(512), MODIFY b1 varbinary(512);
+--enable_warnings
+SELECT length(c1), length(b1) FROM t3;
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t3_myisam ENGINE=MYISAM AS SELECT * FROM t3;
+
+# restore table
+DELETE FROM t3;
+--exec $restore_cmd -n 1 --print -A -P > /dev/null
+--exec $restore_cmd -n 2 --print -A -P > /dev/null
+SELECT length(c1), length(b1) FROM t3;
+
+# verify data
+SELECT COUNT(*) FROM t3 NATURAL JOIN t3_myisam;
+DROP TABLE t3_myisam;
+
+--echo ************************************************************
+--echo * Restoring table with demoted char+binary types preserving padding:
+--echo *     char(32)           -->    varchar(16)
+--echo *     binary(32)         -->    varbinary(16)
+--echo ************************************************************
+
+# demote char+binary type attibutes
+--disable_warnings
+ALTER TABLE t3 MODIFY c1 varchar(16), MODIFY b1 varbinary(16);
+--enable_warnings
+SELECT length(c1), length(b1) FROM t3;
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t3_myisam ENGINE=MYISAM AS SELECT * FROM t3;
+
+# restore table
+DELETE FROM t3;
+--exec $restore_cmd -n 1 --print -L -P > /dev/null
+--exec $restore_cmd -n 2 --print -L -P > /dev/null
+SELECT length(c1), length(b1) FROM t3;
+
+# verify data
+SELECT COUNT(*) FROM t3 NATURAL JOIN t3_myisam;
+DROP TABLE t3_myisam;
+
+--echo ************************************************************
+--echo * Restoring table with promoted char+binary types discarding padding:
+--echo *     char(32)           -->    varchar(32)
+--echo *     binary(32)         -->    varbinary(32)
+--echo ************************************************************
+
+# demote char+binary type attibutes
+--disable_warnings
+DELETE FROM t3;
+ALTER TABLE t3 MODIFY c1 varchar(32), MODIFY b1 varbinary(32);
+INSERT INTO t3 VALUES('aaaaaaaa', 'bbbbbbbb');
+--enable_warnings
+SELECT length(c1), length(b1) FROM t3;
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t3_myisam ENGINE=MYISAM AS SELECT * FROM t3;
+
+# restore table
+DELETE FROM t3;
+--exec $restore_cmd -n 1 --print -A > /dev/null
+--exec $restore_cmd -n 2 --print -A > /dev/null
+SELECT length(c1), length(b1) FROM t3;
+
+# verify data
+SELECT COUNT(*) FROM t3 NATURAL JOIN t3_myisam;
+DROP TABLE t3_myisam;
+
+--echo ************************************************************
+--echo * Restoring table with promoted char+binary types discarding padding:
+--echo *     char(32)           -->    varchar(64)
+--echo *     binary(32)         -->    varbinary(64)
+--echo ************************************************************
+
+# demote char+binary type attibutes
+--disable_warnings
+ALTER TABLE t3 MODIFY c1 varchar(64), MODIFY b1 varbinary(64);
+--enable_warnings
+SELECT length(c1), length(b1) FROM t3;
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t3_myisam ENGINE=MYISAM AS SELECT * FROM t3;
+
+# restore table
+DELETE FROM t3;
+--exec $restore_cmd -n 1 --print -A > /dev/null
+--exec $restore_cmd -n 2 --print -A > /dev/null
+SELECT length(c1), length(b1) FROM t3;
+
+# verify data
+SELECT COUNT(*) FROM t3 NATURAL JOIN t3_myisam;
+DROP TABLE t3_myisam;
+
+--echo ************************************************************
+--echo * Restoring table with promoted char+binary types discarding padding:
+--echo *     char(32)           -->    varchar(512)
+--echo *     binary(32)         -->    varbinary(512)
+--echo ************************************************************
+
+# demote char+binary type attibutes
+--disable_warnings
+ALTER TABLE t3 MODIFY c1 varchar(512), MODIFY b1 varbinary(512);
+--enable_warnings
+SELECT length(c1), length(b1) FROM t3;
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t3_myisam ENGINE=MYISAM AS SELECT * FROM t3;
+
+# restore table
+DELETE FROM t3;
+--exec $restore_cmd -n 1 --print -A > /dev/null
+--exec $restore_cmd -n 2 --print -A > /dev/null
+SELECT length(c1), length(b1) FROM t3;
+
+# verify data
+SELECT COUNT(*) FROM t3 NATURAL JOIN t3_myisam;
+DROP TABLE t3_myisam;
+
+--echo ************************************************************
+--echo * Restoring table with demoted char+binary types discarding padding:
+--echo *     char(32)           -->    varchar(16)
+--echo *     binary(32)         -->    varbinary(16)
+--echo ************************************************************
+
+# demote char+binary type attibutes
+--disable_warnings
+ALTER TABLE t3 MODIFY c1 varchar(16), MODIFY b1 varbinary(16);
+--enable_warnings
+SELECT length(c1), length(b1) FROM t3;
+
+# create a MyISAM table from NDB table, against which to compare data
+CREATE TABLE t3_myisam ENGINE=MYISAM AS SELECT * FROM t3;
+
+# restore table
+DELETE FROM t3;
+--exec $restore_cmd -n 1 --print -L > /dev/null
+--exec $restore_cmd -n 2 --print -L > /dev/null
+SELECT length(c1), length(b1) FROM t3;
+
+# verify data
+SELECT COUNT(*) FROM t3 NATURAL JOIN t3_myisam;
+DROP TABLE t3_myisam;
+
+--echo ************************************************************
+--echo * Deleting table with char+binary types
+--echo ************************************************************
+
+DROP TABLE t3;


Attachment: [text/bzr-bundle] bzr/martin.zaun@oracle.com-20101022054704-un1bcd3hk401y7c2.bundle
Thread
bzr commit into mysql-5.1-telco-6.3 branch (martin.zaun:3319) Martin Zaun22 Oct