diff options
author | unknown <tnurnberg@mysql.com/white.intern.koehntopp.de> | 2008-02-28 14:23:22 +0100 |
---|---|---|
committer | unknown <tnurnberg@mysql.com/white.intern.koehntopp.de> | 2008-02-28 14:23:22 +0100 |
commit | a0eec8abbb233d9e3f278d343eaed2e70b55161e (patch) | |
tree | d7fe47965f56b028624438c1549357c09d710ab1 /mysql-test/r/func_misc.result | |
parent | a4b0a2cf67356c0f8f80b5291b3c1f4f8327cb97 (diff) | |
download | mariadb-git-a0eec8abbb233d9e3f278d343eaed2e70b55161e.tar.gz |
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."
Diffstat (limited to 'mysql-test/r/func_misc.result')
-rw-r--r-- | mysql-test/r/func_misc.result | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result index 4f6b6d3a0d8..cccdd391497 100644 --- a/mysql-test/r/func_misc.result +++ b/mysql-test/r/func_misc.result @@ -207,6 +207,25 @@ test SELECT NAME_CONST('test', 'test'); test test +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +SELECT NAME_CONST('flag',1) * MAX(a) FROM t1; +NAME_CONST('flag',1) * MAX(a) +3 +SELECT NAME_CONST('flag',1.5) * MAX(a) FROM t1; +NAME_CONST('flag',1.5) * MAX(a) +4.5 +SELECT NAME_CONST('flag',-1) * MAX(a) FROM t1; +NAME_CONST('flag',-1) * MAX(a) +-3 +SELECT NAME_CONST('flag',-1.5) * MAX(a) FROM t1; +NAME_CONST('flag',-1.5) * MAX(a) +-4.5 +SELECT NAME_CONST('flag', SQRT(4)) * MAX(a) FROM t1; +ERROR HY000: Incorrect arguments to NAME_CONST +SELECT NAME_CONST('flag',-SQRT(4)) * MAX(a) FROM t1; +ERROR HY000: Incorrect arguments to NAME_CONST +DROP TABLE t1; CREATE TABLE t1 (a int); INSERT INTO t1 VALUES (5), (2); SELECT NAME_CONST(x,2) FROM (SELECT a x FROM t1) t; |