Commit fbe27ca4 authored by unknown's avatar unknown

Merge stella.local:/home2/mydev/mysql-5.1-ateam

into  stella.local:/home2/mydev/mysql-5.1-axmrg

parents 4b20fc0f a41eb645
...@@ -73,3 +73,33 @@ find_in_set(binary 'a', 'A,B,C') ...@@ -73,3 +73,33 @@ find_in_set(binary 'a', 'A,B,C')
select find_in_set('1','3,1,'); select find_in_set('1','3,1,');
find_in_set('1','3,1,') find_in_set('1','3,1,')
2 2
End of 4.1 tests
SELECT INTERVAL(0.0, NULL);
INTERVAL(0.0, NULL)
1
SELECT INTERVAL(0.0, CAST(NULL AS DECIMAL));
INTERVAL(0.0, CAST(NULL AS DECIMAL))
1
SELECT INTERVAL(0.0, CAST(DATE(NULL) AS DECIMAL));
INTERVAL(0.0, CAST(DATE(NULL) AS DECIMAL))
1
SELECT INTERVAL(0.0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INTERVAL(0.0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
8
SELECT INTERVAL(0.0, CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL),
CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL),
CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL));
INTERVAL(0.0, CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL),
CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL),
CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL))
8
SELECT INTERVAL(0.0, CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL));
INTERVAL(0.0, CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL))
8
End of 5.0 tests
...@@ -726,3 +726,11 @@ count(a) ...@@ -726,3 +726,11 @@ count(a)
3 3
drop table t1; drop table t1;
############################################################## ##############################################################
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES(0);
SELECT 1 FROM t1 GROUP BY (DATE(NULL)) WITH ROLLUP;
1
1
1
DROP TABLE t1;
End of 5.0 tests
...@@ -1022,4 +1022,11 @@ NULL NULL NULL ...@@ -1022,4 +1022,11 @@ NULL NULL NULL
select updatexml(NULL, NULL, NULL); select updatexml(NULL, NULL, NULL);
updatexml(NULL, NULL, NULL) updatexml(NULL, NULL, NULL)
NULL NULL
CREATE TABLE t1(a INT NOT NULL);
INSERT INTO t1 VALUES (0), (0);
SELECT 1 FROM t1 ORDER BY(UPDATEXML(a, '1', '1'));
1
1
1
DROP TABLE t1;
End of 5.1 tests End of 5.1 tests
...@@ -54,4 +54,21 @@ select find_in_set(binary 'a', 'A,B,C'); ...@@ -54,4 +54,21 @@ select find_in_set(binary 'a', 'A,B,C');
# #
select find_in_set('1','3,1,'); select find_in_set('1','3,1,');
# End of 4.1 tests --echo End of 4.1 tests
#
# Bug #32560: crash with interval function and count(*)
#
SELECT INTERVAL(0.0, NULL);
SELECT INTERVAL(0.0, CAST(NULL AS DECIMAL));
SELECT INTERVAL(0.0, CAST(DATE(NULL) AS DECIMAL));
SELECT INTERVAL(0.0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
SELECT INTERVAL(0.0, CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL),
CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL),
CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL));
SELECT INTERVAL(0.0, CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL));
--echo End of 5.0 tests
...@@ -367,3 +367,12 @@ select count(a) from t1 group by null with rollup; ...@@ -367,3 +367,12 @@ select count(a) from t1 group by null with rollup;
drop table t1; drop table t1;
--echo ############################################################## --echo ##############################################################
#
# Bug #32558: group by null-returning expression with rollup causes crash
#
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES(0);
SELECT 1 FROM t1 GROUP BY (DATE(NULL)) WITH ROLLUP;
DROP TABLE t1;
--echo End of 5.0 tests
...@@ -543,4 +543,12 @@ select updatexml(NULL, NULL, 1), updatexml(1, NULL, NULL), ...@@ -543,4 +543,12 @@ select updatexml(NULL, NULL, 1), updatexml(1, NULL, NULL),
updatexml(NULL, 1, NULL); updatexml(NULL, 1, NULL);
select updatexml(NULL, NULL, NULL); select updatexml(NULL, NULL, NULL);
#
# Bug #32557: order by updatexml causes assertion in filesort
#
CREATE TABLE t1(a INT NOT NULL);
INSERT INTO t1 VALUES (0), (0);
SELECT 1 FROM t1 ORDER BY(UPDATEXML(a, '1', '1'));
DROP TABLE t1;
--echo End of 5.1 tests --echo End of 5.1 tests
...@@ -1694,26 +1694,29 @@ bool Item_func_opt_neg::eq(const Item *item, bool binary_cmp) const ...@@ -1694,26 +1694,29 @@ bool Item_func_opt_neg::eq(const Item *item, bool binary_cmp) const
void Item_func_interval::fix_length_and_dec() void Item_func_interval::fix_length_and_dec()
{ {
uint rows= row->cols();
use_decimal_comparison= ((row->element_index(0)->result_type() == use_decimal_comparison= ((row->element_index(0)->result_type() ==
DECIMAL_RESULT) || DECIMAL_RESULT) ||
(row->element_index(0)->result_type() == (row->element_index(0)->result_type() ==
INT_RESULT)); INT_RESULT));
if (row->cols() > 8) if (rows > 8)
{ {
bool consts=1; bool not_null_consts= TRUE;
for (uint i=1 ; consts && i < row->cols() ; i++) for (uint i= 1; not_null_consts && i < rows; i++)
{ {
consts&= row->element_index(i)->const_item(); Item *el= row->element_index(i);
not_null_consts&= el->const_item() & !el->is_null();
} }
if (consts && if (not_null_consts &&
(intervals= (intervals=
(interval_range*) sql_alloc(sizeof(interval_range)*(row->cols()-1)))) (interval_range*) sql_alloc(sizeof(interval_range) * (rows - 1))))
{ {
if (use_decimal_comparison) if (use_decimal_comparison)
{ {
for (uint i=1 ; i < row->cols(); i++) for (uint i= 1; i < rows; i++)
{ {
Item *el= row->element_index(i); Item *el= row->element_index(i);
interval_range *range= intervals + (i-1); interval_range *range= intervals + (i-1);
...@@ -1738,7 +1741,7 @@ void Item_func_interval::fix_length_and_dec() ...@@ -1738,7 +1741,7 @@ void Item_func_interval::fix_length_and_dec()
} }
else else
{ {
for (uint i=1 ; i < row->cols(); i++) for (uint i= 1; i < rows; i++)
{ {
intervals[i-1].dbl= row->element_index(i)->val_real(); intervals[i-1].dbl= row->element_index(i)->val_real();
} }
...@@ -1829,12 +1832,22 @@ longlong Item_func_interval::val_int() ...@@ -1829,12 +1832,22 @@ longlong Item_func_interval::val_int()
((el->result_type() == DECIMAL_RESULT) || ((el->result_type() == DECIMAL_RESULT) ||
(el->result_type() == INT_RESULT))) (el->result_type() == INT_RESULT)))
{ {
my_decimal e_dec_buf, *e_dec= row->element_index(i)->val_decimal(&e_dec_buf); my_decimal e_dec_buf, *e_dec= el->val_decimal(&e_dec_buf);
/* Skip NULL ranges. */
if (el->null_value)
continue;
if (my_decimal_cmp(e_dec, dec) > 0) if (my_decimal_cmp(e_dec, dec) > 0)
return i-1; return i - 1;
}
else
{
double val= el->val_real();
/* Skip NULL ranges. */
if (el->null_value)
continue;
if (val > value)
return i - 1;
} }
else if (row->element_index(i)->val_real() > value)
return i-1;
} }
return i-1; return i-1;
} }
......
...@@ -789,7 +789,7 @@ class Item_func_rollup_const :public Item_func ...@@ -789,7 +789,7 @@ class Item_func_rollup_const :public Item_func
max_length= args[0]->max_length; max_length= args[0]->max_length;
decimals=args[0]->decimals; decimals=args[0]->decimals;
/* The item could be a NULL constant. */ /* The item could be a NULL constant. */
null_value= args[0]->null_value; null_value= args[0]->is_null();
} }
}; };
......
...@@ -28,8 +28,16 @@ class Item_xml_str_func: public Item_str_func ...@@ -28,8 +28,16 @@ class Item_xml_str_func: public Item_str_func
String tmp_value, pxml; String tmp_value, pxml;
Item *nodeset_func; Item *nodeset_func;
public: public:
Item_xml_str_func(Item *a, Item *b): Item_str_func(a,b) {} Item_xml_str_func(Item *a, Item *b):
Item_xml_str_func(Item *a, Item *b, Item *c): Item_str_func(a,b,c) {} Item_str_func(a,b)
{
maybe_null= TRUE;
}
Item_xml_str_func(Item *a, Item *b, Item *c):
Item_str_func(a,b,c)
{
maybe_null= TRUE;
}
void fix_length_and_dec(); void fix_length_and_dec();
String *parse_xml(String *raw_xml, String *parsed_xml_buf); String *parse_xml(String *raw_xml, String *parsed_xml_buf);
}; };
......
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