From 7b892368c36cb003f9a69bbbb0e4b702a910edcf Mon Sep 17 00:00:00 2001
From: "pekka@mysql.com" <>
Date: Fri, 3 Feb 2006 14:35:29 +0100
Subject: [PATCH] ndb - bugfix: tinyblob + replace => mysqld crash (no bug#)

---
 mysql-test/r/ndb_blob.result | 7 +++++++
 mysql-test/t/ndb_blob.test   | 6 +++++-
 ndb/src/ndbapi/NdbBlob.cpp   | 2 ++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/mysql-test/r/ndb_blob.result b/mysql-test/r/ndb_blob.result
index f806cf08ea9..b1269564558 100644
--- a/mysql-test/r/ndb_blob.result
+++ b/mysql-test/r/ndb_blob.result
@@ -428,6 +428,13 @@ delete from t1;
 select * from t1;
 a	b
 commit;
+replace t1 set a=2, b='y';
+select * from t1;
+a	b
+2	y
+delete from t1;
+select * from t1;
+a	b
 drop table t1;
 set autocommit=0;
 create table t1 (
diff --git a/mysql-test/t/ndb_blob.test b/mysql-test/t/ndb_blob.test
index a12ebee2f0d..f80b7f71281 100644
--- a/mysql-test/t/ndb_blob.test
+++ b/mysql-test/t/ndb_blob.test
@@ -338,7 +338,7 @@ select * from t1 order by a;
 drop table t1;
 drop database test2;
 
-# -- bug-5252 tinytext crashes plus no-commit result --
+# -- bug-5252 tinytext crashes + no-commit result + replace --
 
 set autocommit=0;
 create table t1 (
@@ -352,6 +352,10 @@ select * from t1;
 delete from t1;
 select * from t1;
 commit;
+replace t1 set a=2, b='y';
+select * from t1;
+delete from t1;
+select * from t1;
 drop table t1;
 
 # -- bug-5013 insert empty string to text --
diff --git a/ndb/src/ndbapi/NdbBlob.cpp b/ndb/src/ndbapi/NdbBlob.cpp
index d1aa4e61c40..35cf71b5e5a 100644
--- a/ndb/src/ndbapi/NdbBlob.cpp
+++ b/ndb/src/ndbapi/NdbBlob.cpp
@@ -947,6 +947,8 @@ NdbBlob::deletePartsUnknown(Uint32 part)
 {
   DBUG_ENTER("NdbBlob::deletePartsUnknown");
   DBUG_PRINT("info", ("part=%u count=all", part));
+  if (thePartSize == 0) // tinyblob
+    DBUG_RETURN(0);
   static const unsigned maxbat = 256;
   static const unsigned minbat = 1;
   unsigned bat = minbat;
-- 
2.30.9