Below is the list of changes that have just been committed into a local
5.0 repository of martin. When martin does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-09-28 18:05:23+02:00, mhansson@stripped +3 -0
Bug #30832: Assertion + crash with select name_const('test', now());
The NAME_CONST function is required to work correctly with constants only.
When executed with functions that return types other than those returned by
Item::field_type (string, int, decimal, or real), the result gets cast to
one of those types. This cannot happen for constants.
Fixed by only allowing constants as arguments to NAME_CONST.
mysql-test/r/func_misc.result@stripped, 2007-09-28 18:05:20+02:00, mhansson@stripped
+16 -0
Bug#30832: Test result
mysql-test/t/func_misc.test@stripped, 2007-09-28 18:05:20+02:00, mhansson@stripped
+14 -0
Bug#30832: Test case
sql/item.h@stripped, 2007-09-28 18:05:20+02:00, mhansson@stripped +2 -0
Bug#30832: The fix
diff -Nrup a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result
--- a/mysql-test/r/func_misc.result 2007-03-02 03:20:46 +01:00
+++ b/mysql-test/r/func_misc.result 2007-09-28 18:05:20 +02:00
@@ -185,4 +185,20 @@ ERROR 21000: Operand should contain 1 co
drop table table_26093;
drop function func_26093_a;
drop function func_26093_b;
+SELECT NAME_CONST('test', NOW());
+ERROR HY000: Incorrect arguments to NAME_CONST
+SELECT NAME_CONST('test', UPPER('test'));
+ERROR HY000: Incorrect arguments to NAME_CONST
+SELECT NAME_CONST('test', NULL);
+test
+NULL
+SELECT NAME_CONST('test', 1);
+test
+1
+SELECT NAME_CONST('test', 1.0);
+test
+1.0
+SELECT NAME_CONST('test', 'test');
+test
+test
End of 5.0 tests
diff -Nrup a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test
--- a/mysql-test/t/func_misc.test 2007-03-02 03:20:46 +01:00
+++ b/mysql-test/t/func_misc.test 2007-09-28 18:05:20 +02:00
@@ -189,4 +189,18 @@ drop table table_26093;
drop function func_26093_a;
drop function func_26093_b;
+#
+# Bug #30832: Assertion + crash with select name_const('test',now());
+#
+--error ER_WRONG_ARGUMENTS
+SELECT NAME_CONST('test', NOW());
+--error ER_WRONG_ARGUMENTS
+SELECT NAME_CONST('test', UPPER('test'));
+
+SELECT NAME_CONST('test', NULL);
+SELECT NAME_CONST('test', 1);
+SELECT NAME_CONST('test', 1.0);
+SELECT NAME_CONST('test', 'test');
+
--echo End of 5.0 tests
+
diff -Nrup a/sql/item.h b/sql/item.h
--- a/sql/item.h 2007-08-03 18:59:12 +02:00
+++ b/sql/item.h 2007-09-28 18:05:20 +02:00
@@ -1112,6 +1112,8 @@ public:
Item_name_const(Item *name_arg, Item *val):
value_item(val), name_item(name_arg)
{
+ if(!value_item->basic_const_item())
+ my_error(ER_WRONG_ARGUMENTS, MYF(0), "NAME_CONST");
Item::maybe_null= TRUE;
}
| Thread |
|---|
| • bk commit into 5.0 tree (mhansson:1.2530) BUG#30832 | mhansson | 28 Sep |