diff options
-rw-r--r-- | BitKeeper/etc/logging_ok | 1 | ||||
-rw-r--r-- | mysql-test/r/func_compress.result | 6 | ||||
-rw-r--r-- | mysql-test/t/func_compress.test | 6 | ||||
-rw-r--r-- | sql/item_strfunc.cc | 10 |
4 files changed, 23 insertions, 0 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index dff4cec203c..48144e71863 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -97,6 +97,7 @@ peter@linux.local peter@mysql.com peterg@mysql.com pgulutzan@linux.local +ram@gw.mysql.r18.ru ram@gw.udmsearch.izhnet.ru ram@mysql.r18.ru ram@ram.(none) diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result index c4d2eacf363..57eef44b3bb 100644 --- a/mysql-test/r/func_compress.result +++ b/mysql-test/r/func_compress.result @@ -40,3 +40,9 @@ uncompress(compress("")) select uncompressed_length(""); uncompressed_length("") 0 +select compress(NULL); +compress(NULL) +NULL +select uncompress(NULL); +uncompress(NULL) +NULL diff --git a/mysql-test/t/func_compress.test b/mysql-test/t/func_compress.test index 826721a4053..7462c020357 100644 --- a/mysql-test/t/func_compress.test +++ b/mysql-test/t/func_compress.test @@ -23,3 +23,9 @@ select uncompress(""); select uncompress(compress("")); select uncompressed_length(""); +# +# NULL (Bug #1333) +# + +select compress(NULL); +select uncompress(NULL); diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index c4ad7f1e1e2..50dbd00e43f 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2539,6 +2539,11 @@ longlong Item_func_crc32::val_int() String *Item_func_compress::val_str(String *str) { String *res= args[0]->val_str(str); + if (!res) + { + null_value= 1; + return 0; + } if (res->is_empty()) return res; int err= Z_OK; @@ -2589,6 +2594,11 @@ String *Item_func_compress::val_str(String *str) String *Item_func_uncompress::val_str(String *str) { String *res= args[0]->val_str(str); + if (!res) + { + null_value= 1; + return 0; + } if (res->is_empty()) return res; ulong new_size= uint4korr(res->c_ptr()) & 0x3FFFFFFF; |