mirror of
https://github.com/MariaDB/server.git
synced 2026-05-14 19:07:15 +02:00
Bug#34749: Server crash when using NAME_CONST() with an aggregate function
NAME_CONST('whatever', -1) * MAX(whatever) bombed since -1 was
not seen as constant, but as FUNCTION_UNARY_MINUS(constant)
while we are at the same time pretending it was a basic const
item. This confused the aggregate handlers in exciting ways.
We now make NAME_CONST() behave more consistently.
mysql-test/r/func_misc.result:
show that a combination of NAME_CONST('x', -y) and an aggregate
no longer crashes the server.
mysql-test/t/func_misc.test:
show that a combination of NAME_CONST('x', -y) and an aggregate
no longer crashes the server.
sql/ha_ndbcluster_cond.cc:
tell cluster about "new" function type NEG_FUNC.
(this was previous identified as UNKNOWN_FUNC,
so we just handle it the same way, that's all.)
sql/ha_ndbcluster_cond.h:
tell cluster about "new" function type NEG_FUNC.
(this was previous identified as UNKNOWN_FUNC,
so we just handle it the same way, that's all.)
sql/item.cc:
make NAME_CONST() transparent in that type() of
-constant is that of constant, not that of unary
minus (id est, FUNC_ITEM).
sql/item.h:
Move constructor to item.cc
sql/item_func.h:
Revert Bug#30832; we can apply the magic more narrowly
(just for NAME_CONST() rather than all Item_func_neg).
Introduce new function type "NEG_FUNC."
This commit is contained in:
parent
a4b0a2cf67
commit
a0eec8abbb
7 changed files with 74 additions and 14 deletions
|
|
@ -117,7 +117,8 @@ void ndb_serialize_cond(const Item *item, void *arg)
|
|||
if (item->type() == Item::FUNC_ITEM)
|
||||
{
|
||||
Item_func *func_item= (Item_func *) item;
|
||||
if (func_item->functype() == Item_func::UNKNOWN_FUNC &&
|
||||
if ((func_item->functype() == Item_func::UNKNOWN_FUNC ||
|
||||
func_item->functype() == Item_func::NEG_FUNC) &&
|
||||
func_item->const_item())
|
||||
{
|
||||
// Skip any arguments since we will evaluate function instead
|
||||
|
|
@ -369,8 +370,9 @@ void ndb_serialize_cond(const Item *item, void *arg)
|
|||
{
|
||||
Item_func *func_item= (Item_func *) item;
|
||||
// Check that we expect a function or functional expression here
|
||||
if (context->expecting(Item::FUNC_ITEM) ||
|
||||
func_item->functype() == Item_func::UNKNOWN_FUNC)
|
||||
if (context->expecting(Item::FUNC_ITEM) ||
|
||||
func_item->functype() == Item_func::UNKNOWN_FUNC ||
|
||||
func_item->functype() == Item_func::NEG_FUNC)
|
||||
context->expect_nothing();
|
||||
else
|
||||
{
|
||||
|
|
@ -584,6 +586,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
|
|||
context->expect(Item::FUNC_ITEM);
|
||||
break;
|
||||
}
|
||||
case Item_func::NEG_FUNC:
|
||||
case Item_func::UNKNOWN_FUNC:
|
||||
{
|
||||
DBUG_PRINT("info", ("UNKNOWN_FUNC %s",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue