Commit 476f4f4
committed
Bug#27041526 assertion `mon > 0 && mon < 13' failed.
The problem is that, when the value of a timestamp field is
used as argument to IF() condition in SQL, its
datatype/value changes based on the setting of variable
collation_connection. More details of this issue is
reported in Bug#27143384. This bug will be fixed independent
of fix for this bug. The root cause of core dump is that the
value of mysql.table_stats.cached_time is treated as a
string value, when collation_connection is set to
utf32_general_ci. Converting this string version of
timestamp into a integer value gives us a invalid longlong
timestamp value. When we use this wrong timestamp value to
get MYSQL_TIME, we end-up getting invalid date values and
assert.
The expression which hits the issue in Bug#27143384 is,
"IF(ISNULL(timestamp_field), 0, timestamp_field)". This
patch uses COALESCE() which suite better. Part of problem
was the optimizer by default converts the timestamp fields
into strings. And the IF() resulted in automatic conversion
to integer only in certain charset (as discussed in
bug27143384). In order to avoid depending on implicit
conversions, this patch uses CAST() to explicitly request
the timestamp value as a unsigned value. This code change
can be a permanent change, and need not really be reverted
back after Bug#27143384 is fixed.
The patch also sets null_on_null property for UDF's as
false. The UDF return's NULL as soon as it sees one of it's
argument is NULL. This change is not really required for
the fix in hand. However, this change was expected to be done
for UDF's implemented in I_S as per optimizer's suggestions
in past. The test case contains a SELECT with TABLE_ROWS
column in WHERE condition, which demonstrates the problem.
The patch also sets the few other internal I_S functions
with Functype as DD_INTERNAL_FUNC. This was a omission
when I_S.FILES system view was implemented.
A new test case is added to main.information_schema.
Change-Id: I6904103094c288958af46b6c203a726c31b3093d1 parent a2e09bf commit 476f4f4
File tree
14 files changed
+158
-74
lines changed- mysql-test
- r
- suite/funcs_1/r
- t
- sql
- dd/impl/system_views
14 files changed
+158
-74
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2566 | 2566 | | |
2567 | 2567 | | |
2568 | 2568 | | |
| 2569 | + | |
| 2570 | + | |
| 2571 | + | |
| 2572 | + | |
| 2573 | + | |
| 2574 | + | |
| 2575 | + | |
| 2576 | + | |
| 2577 | + | |
| 2578 | + | |
| 2579 | + | |
| 2580 | + | |
| 2581 | + | |
| 2582 | + | |
| 2583 | + | |
| 2584 | + | |
| 2585 | + | |
| 2586 | + | |
| 2587 | + | |
| 2588 | + | |
| 2589 | + | |
| 2590 | + | |
| 2591 | + | |
| 2592 | + | |
| 2593 | + | |
| 2594 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2566 | 2566 | | |
2567 | 2567 | | |
2568 | 2568 | | |
| 2569 | + | |
| 2570 | + | |
| 2571 | + | |
| 2572 | + | |
| 2573 | + | |
| 2574 | + | |
| 2575 | + | |
| 2576 | + | |
| 2577 | + | |
| 2578 | + | |
| 2579 | + | |
| 2580 | + | |
| 2581 | + | |
| 2582 | + | |
| 2583 | + | |
| 2584 | + | |
| 2585 | + | |
| 2586 | + | |
| 2587 | + | |
| 2588 | + | |
| 2589 | + | |
| 2590 | + | |
| 2591 | + | |
| 2592 | + | |
| 2593 | + | |
| 2594 | + | |
0 commit comments