diff options
author | unknown <mhansson/martin@linux-st28.site> | 2007-09-28 18:05:23 +0200 |
---|---|---|
committer | unknown <mhansson/martin@linux-st28.site> | 2007-09-28 18:05:23 +0200 |
commit | 582388e6d299b00db93f633ddace537c51eb66d4 (patch) | |
tree | 551d4d3af29fc4e937cd64cbd4c04e9111396351 /sql/item.h | |
parent | 692b686dae872c4d93f472d11d16eb8807076f98 (diff) | |
download | mariadb-git-582388e6d299b00db93f633ddace537c51eb66d4.tar.gz |
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:
Bug#30832: Test result
mysql-test/t/func_misc.test:
Bug#30832: Test case
sql/item.h:
Bug#30832: The fix
Diffstat (limited to 'sql/item.h')
-rw-r--r-- | sql/item.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sql/item.h b/sql/item.h index 3c699c0eda3..cd0be343a62 100644 --- a/sql/item.h +++ b/sql/item.h @@ -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; } |