Commit d8330e28 authored by cmiller@zippy.(none)'s avatar cmiller@zippy.(none)

Merge zippy.(none):/home/cmiller/work/mysql/merge/tmp_merge

into  zippy.(none):/home/cmiller/work/mysql/merge/mysql-5.1-new
parents faedacaf 31e22776
...@@ -2339,7 +2339,7 @@ print_table_data(MYSQL_RES *result) ...@@ -2339,7 +2339,7 @@ print_table_data(MYSQL_RES *result)
uint extra_padding; uint extra_padding;
/* If this column may have a null value, use "NULL" for empty. */ /* If this column may have a null value, use "NULL" for empty. */
if (! not_null_flag[off] && (lengths[off] == 0)) if (! not_null_flag[off] && (cur[off] == NULL))
{ {
buffer= "NULL"; buffer= "NULL";
data_length= 4; data_length= 4;
......
...@@ -732,6 +732,25 @@ SELECT count(*) FROM t1 WHERE d>FROM_DAYS(TO_DAYS(@TMP)) AND d<=FROM_DAYS(TO_DAY ...@@ -732,6 +732,25 @@ SELECT count(*) FROM t1 WHERE d>FROM_DAYS(TO_DAYS(@TMP)) AND d<=FROM_DAYS(TO_DAY
count(*) count(*)
3 3
DROP TABLE t1; DROP TABLE t1;
select last_day('2005-00-00');
last_day('2005-00-00')
NULL
Warnings:
Warning 1292 Truncated incorrect datetime value: '2005-00-00'
select last_day('2005-00-01');
last_day('2005-00-01')
NULL
Warnings:
Warning 1292 Truncated incorrect datetime value: '2005-00-01'
select last_day('2005-01-00');
last_day('2005-01-00')
NULL
Warnings:
Warning 1292 Truncated incorrect datetime value: '2005-01-00'
select monthname(str_to_date(null, '%m')), monthname(str_to_date(null, '%m')),
monthname(str_to_date(1, '%m')), monthname(str_to_date(0, '%m'));
monthname(str_to_date(null, '%m')) monthname(str_to_date(null, '%m')) monthname(str_to_date(1, '%m')) monthname(str_to_date(0, '%m'))
NULL NULL January NULL
explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1, explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1,
timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a2; timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a2;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
......
...@@ -74,7 +74,7 @@ c_cp932 ...@@ -74,7 +74,7 @@ c_cp932
+----------------------+------------+--------+ +----------------------+------------+--------+
| >a < | b | 123421 | | >a < | b | 123421 |
| >a < | 0123456789 | 4 | | >a < | 0123456789 | 4 |
| >abcd< | NULL | 4 | | >abcd< | | 4 |
+----------------------+------------+--------+ +----------------------+------------+--------+
+------+------+---------------------------+ +------+------+---------------------------+
| i | j | k | | i | j | k |
...@@ -94,6 +94,14 @@ c_cp932 ...@@ -94,6 +94,14 @@ c_cp932
| Field | Type | Null | Key | Default | Extra | | Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+ +-------+---------+------+-----+---------+-------+
| i | int(11) | YES | | NULL | | | i | int(11) | YES | | NULL | |
| j | int(11) | NO | | NULL | | | j | int(11) | NO | | | |
| k | int(11) | YES | | NULL | | | k | int(11) | YES | | NULL | |
+-------+---------+------+-----+---------+-------+ +-------+---------+------+-----+---------+-------+
+------+------+
| i | s1 |
+------+------+
| 1 | x |
| 2 | NULL |
| 3 | |
+------+------+
End of 5.0 tests
...@@ -352,6 +352,20 @@ INSERT INTO t1 VALUES (NOW()); ...@@ -352,6 +352,20 @@ INSERT INTO t1 VALUES (NOW());
SELECT count(*) FROM t1 WHERE d>FROM_DAYS(TO_DAYS(@TMP)) AND d<=FROM_DAYS(TO_DAYS(@TMP)+1); SELECT count(*) FROM t1 WHERE d>FROM_DAYS(TO_DAYS(@TMP)) AND d<=FROM_DAYS(TO_DAYS(@TMP)+1);
DROP TABLE t1; DROP TABLE t1;
#
# Bug #10568
#
select last_day('2005-00-00');
select last_day('2005-00-01');
select last_day('2005-01-00');
#
# Bug #18501: monthname and NULLs
#
select monthname(str_to_date(null, '%m')), monthname(str_to_date(null, '%m')),
monthname(str_to_date(1, '%m')), monthname(str_to_date(0, '%m'));
# End of 4.1 tests # End of 4.1 tests
......
...@@ -72,3 +72,11 @@ drop table t1; ...@@ -72,3 +72,11 @@ drop table t1;
# #
--exec $MYSQL -t --default-character-set utf8 test -e "create table t1 (i int, j int not null, k int); insert into t1 values (null, 1, null); select * from t1; describe t1; drop table t1;" --exec $MYSQL -t --default-character-set utf8 test -e "create table t1 (i int, j int not null, k int); insert into t1 values (null, 1, null); select * from t1; describe t1; drop table t1;"
#
# Bug#19564: mysql displays NULL instead of space
#
--exec $MYSQL -t test -e "create table b19564 (i int, s1 char(1)); insert into b19564 values (1, 'x'); insert into b19564 values (2, NULL); insert into b19564 values (3, ' '); select * from b19564 order by i; drop table b19564;"
--echo End of 5.0 tests
...@@ -870,9 +870,9 @@ String* Item_func_monthname::val_str(String* str) ...@@ -870,9 +870,9 @@ String* Item_func_monthname::val_str(String* str)
{ {
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
const char *month_name; const char *month_name;
uint month=(uint) Item_func_month::val_int(); uint month= (uint) val_int();
if (!month) // This is also true for NULL if (null_value || !month)
{ {
null_value=1; null_value=1;
return (String*) 0; return (String*) 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment