summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <holyfoot/hf@hfmain.(none)>2007-11-05 18:12:42 +0400
committerunknown <holyfoot/hf@hfmain.(none)>2007-11-05 18:12:42 +0400
commit62617b09c3ffd2fbd512f6a038dfa20a37df4c3b (patch)
treeae24652ad56bfe7d209902f423129f66134466e8
parent9e6bb07d3845566ffa7274bb14df544c8147f594 (diff)
parente722393f519400c2f14999cbc669cafea648aa9e (diff)
downloadmariadb-git-62617b09c3ffd2fbd512f6a038dfa20a37df4c3b.tar.gz
Merge mysql.com:/home/hf/work/31758/my41-31758
into mysql.com:/home/hf/work/31758/my50-31758 mysql-test/t/func_str.test: Auto merged mysql-test/r/func_str.result: merging sql/item_strfunc.h: merging
-rw-r--r--mysql-test/r/func_str.result12
-rw-r--r--mysql-test/t/func_str.test13
-rw-r--r--sql/item_strfunc.h5
3 files changed, 28 insertions, 2 deletions
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index e0b4161a6a0..d6879a8e756 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -1096,6 +1096,18 @@ id select_type table type possible_keys key key_len ref rows Extra
Warnings:
Note 1003 select decode('','zxcv') AS `enc` from `test`.`t1`
drop table t1;
+create table t1 (a bigint not null)engine=myisam;
+insert into t1 set a = 1024*1024*1024*4;
+delete from t1 order by (inet_ntoa(a)) desc limit 10;
+drop table t1;
+create table t1 (a char(36) not null)engine=myisam;
+insert ignore into t1 set a = ' ';
+insert ignore into t1 set a = ' ';
+select * from t1 order by (oct(a));
+a
+
+
+drop table t1;
End of 4.1 tests
create table t1 (d decimal default null);
insert into t1 values (null);
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index e04276fa305..1ca2bbfaf4c 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -738,6 +738,19 @@ explain extended select encode(f1,'zxcv') as 'enc' from t1;
explain extended select decode(f1,'zxcv') as 'enc' from t1;
drop table t1;
+#
+# Bug #31758 inet_ntoa, oct, crashes server with null + filesort
+#
+create table t1 (a bigint not null)engine=myisam;
+insert into t1 set a = 1024*1024*1024*4;
+delete from t1 order by (inet_ntoa(a)) desc limit 10;
+drop table t1;
+create table t1 (a char(36) not null)engine=myisam;
+insert ignore into t1 set a = ' ';
+insert ignore into t1 set a = ' ';
+select * from t1 order by (oct(a));
+drop table t1;
+
--echo End of 4.1 tests
#
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 04d1997e879..7607ebfc761 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -584,7 +584,8 @@ public:
void fix_length_and_dec()
{
collation.set(default_charset());
- max_length= 64;
+ max_length=64;
+ maybe_null= 1;
}
};
@@ -682,7 +683,7 @@ public:
}
String* val_str(String* str);
const char *func_name() const { return "inet_ntoa"; }
- void fix_length_and_dec() { decimals = 0; max_length=3*8+7; }
+ void fix_length_and_dec() { decimals = 0; max_length=3*8+7; maybe_null=1;}
};
class Item_func_quote :public Item_str_func