summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.h
diff options
context:
space:
mode:
authorGleb Shchepa <gleb.shchepa@oracle.com>2010-10-31 19:04:38 +0300
committerGleb Shchepa <gleb.shchepa@oracle.com>2010-10-31 19:04:38 +0300
commit20d704978ddb14dee414f40f28bd58f82b21711c (patch)
tree3af3b3116a958e716120f22f95ce5af2b4799b03 /sql/item_timefunc.h
parent23552ecd41ec6679fd90f57ad982db8abf09c4ea (diff)
downloadmariadb-git-20d704978ddb14dee414f40f28bd58f82b21711c.tar.gz
Bug #52160: crash and inconsistent results when grouping
by a function and column The bugreport reveals two different bugs about grouping on a function: 1) grouping by the TIME_TO_SEC function result caused a server crash or wrong results and 2) grouping by the function returning a blob caused an unexpected "Duplicate entry" error and wrong result. Details for the 1st bug: TIME_TO_SEC() returns NULL if its argument is invalid (empty string for example). Thus its nullability depends not only on the nullability of its arguments but also on their values. Fixed by (overoptimistically) setting TIME_TO_SEC() to be nullable despite the nullability of its arguments. Details for the 2nd bug: The server is unable to create indices on blobs without explicit blob key part length. However, this fact was ignored for blob function result fields of GROUP BY intermediate tables. Fixed by disabling GROUP BY index creation for blob function result fields like regular blob fields. mysql-test/r/func_time.result: Test case for bug #52160. mysql-test/r/type_blob.result: Test case for bug #52160. mysql-test/t/func_time.test: Test case for bug #52160. mysql-test/t/type_blob.test: Test case for bug #52160. sql/item_timefunc.h: Bug #52160: crash and inconsistent results when grouping by a function and column TIME_TO_SEC() returns NULL if its argument is invalid (empty string for example). Thus its nullability depends not only Fixed by (overoptimistically) setting TIME_TO_SEC() to be nullable despite the nullability of its arguments. sql/sql_select.cc: Bug #52160: crash and inconsistent results when grouping by a function and column The server is unable to create indices on blobs without explicit blob key part length. However, this fact was ignored for blob function result fields of GROUP BY intermediate tables. Fixed by disabling GROUP BY index creation for blob function result fields like regular blob fields.
Diffstat (limited to 'sql/item_timefunc.h')
-rw-r--r--sql/item_timefunc.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index ef86406e1be..47bb9509582 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -331,6 +331,7 @@ public:
const char *func_name() const { return "time_to_sec"; }
void fix_length_and_dec()
{
+ maybe_null= TRUE;
decimals=0;
max_length=10*MY_CHARSET_BIN_MB_MAXLEN;
}