Details
-
Bug
-
Status: Open (View Workflow)
-
Critical
-
Resolution: Unresolved
-
N/A
-
None
Description
Here is the missing coverage report as of bb-12.3-MDEV-19683-to_date 98b01265df03446ce9a861e044e3cde19225afe4, mtr default set, nm + ps.
Lines with zero coverage (99/1238):
|
|
|
===File sql/item_func.h:
|
923 : + virtual bool get_date_common(THD *thd, MYSQL_TIME *ltime,
|
926 : + DBUG_ASSERT(0);
|
927 : + return 0;
|
|
|
===File sql/item_timefunc.cc:
|
668 : + else if (format_char == *val)
|
670 : + val++;
|
686 : + case FMT_YYY:
|
687 : + tmp= (char*) val + MY_MIN(3, val_len);
|
688 : + l_time->year= ((int) my_strtoll10(val, &tmp, &error) +
|
689 : + l_time->year/1000*1000);
|
690 : + val= tmp;
|
691 : + break;
|
698 : + case FMT_Y:
|
699 : + tmp= (char*) val + MY_MIN(1, val_len);
|
700 : + l_time->year= ((int) my_strtoll10(val, &tmp, &error) +
|
701 : + l_time->year/10*10);
|
702 : + val= tmp;
|
703 : + break;
|
713 : + case FMT_RRRR:
|
716 : + tmp= (char*) val + MY_MIN(4, val_len);
|
717 : + year= (uint)my_strtoll10(val, &tmp, &error);
|
718 : + l_time->year= year > 100 ? year : oracle_year_2000_handling(year);
|
719 : + val= tmp;
|
720 : + break;
|
730 : + goto error;
|
749 : + goto error;
|
804 : + goto error;
|
811 : + val+= 2;
|
814 : + daypart= 12;
|
815 : + val+= 4;
|
820 : + goto error;
|
826 : + goto error;
|
828 : + case FMT_DY:
|
829 : + if ((weekday= check_word(locale->ab_day_names, val, val_end, &val)) <= 0)
|
830 : + goto error;
|
831 : + break;
|
839 : + default:
|
840 : + goto error;
|
850 : + goto error;
|
859 : + goto error;
|
889 : + } while (++val != val_end);
|
2608 : + goto error;
|
2616 : + goto error;
|
2626 : + goto error;
|
2634 : + goto error;
|
2650 : + goto error;
|
2672 : + goto error;
|
2701 : + goto error;
|
2704 : + goto error;
|
2726 : + goto error;
|
2762 : + goto error;
|
2793 : + goto error;
|
2802 : + goto error;
|
2813 : + goto error;
|
2856 : + goto error;
|
2894 : + goto error;
|
2936 : + goto error;
|
2943 : + !my_charset_latin1.strnncoll(ptr+1, 4, "YYYY", 4))
|
2976 : + goto error;
|
2983 : + goto error;
|
3213 : + goto err_exit;
|
3225 : + goto err_exit;
|
3238 : + goto err_exit;
|
3245 : + goto err_exit;
|
3250 : + goto err_exit;
|
4671 : + return true;
|
4678 : + return true;
|
4682 : + return true;
|
4695 : + return true; // Empty values are not allowed
|
4706 : + return 1;
|
4743 : + return;
|
4797 : +void Item_func_to_date::print(String *str, enum_query_type query_type)
|
4799 : + str->append(func_name_cstring());
|
4800 : + str->append('(');
|
4801 : + args[0]->print(str, query_type);
|
4802 : + if (arg_count == 3)
|
4804 : + str->append(STRING_WITH_LEN("DEFAULT "));
|
4805 : + args[2]->print(str, query_type);
|
4806 : + str->append(STRING_WITH_LEN(" ON CONVERSION ERROR"));
|
4808 : + str->append(',');
|
4809 : + args[1]->print(str, query_type);
|
4810 : + if (nls_param.length)
|
4812 : + str->append(',');
|
4813 : + str->append(nls_param);
|
4815 : + str->append(')');
|
4816 : +}
|
4823 : + return true;
|
4833 : + my_error(ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION, MYF(0),
|
4834 : + args[0]->type_handler()->name().ptr(),
|
4835 : + args[2]->type_handler()->name().ptr(), func_name());
|
4836 : + return TRUE;
|
4839 : + return TRUE;
|
4841 : + internal_charset= &my_charset_utf8mb4_general_ci;
|
4877 : + goto error;
|
4884 : + goto error;
|
4888 : + goto error;
|
|
|
===File sql/item_timefunc.h:
|
1842 : + Item *do_get_copy(THD *thd) const override
|
1843 : + { return get_item_copy<Item_func_to_date>(thd, this); }
|
|
|
===File sql/sql_yacc.yy:
|
10421 : + MYSQL_YYABORT;
|
10428 : + MYSQL_YYABORT;
|
There are a few obvious omissions, e.g. formats 'YYY', 'RRRR', 'DY', and 'Y' aren't covered, as well as the print function. Additions like below (just examples, could probably be optimized and/or extended) bring the missing line count down to 60, mostly error handling, see attachments for full reports. I suggest dealing with the main part first, and then we'll do another run to see what remains that is worth to be done.
Note that the last block in SQL below, the one with geometry, currently crashes with MDEV-38403, so it shouldn't be added to tests until the bug is fixed.
SET timestamp = UNIX_TIMESTAMP('2025-12-21'); |
|
|
SELECT TO_DATE('0', 'YYY') AS result; |
SELECT TO_DATE('25', 'YYY') AS result; |
SELECT TO_DATE('1000', 'YYY') AS result; |
|
|
SELECT TO_DATE('0', 'RRRR') AS result; |
SELECT TO_DATE('25', 'RRRR') AS result; |
SELECT TO_DATE('999', 'RRRR') AS result; |
SELECT TO_DATE('1000', 'RRRR') AS result; |
SELECT TO_DATE('10000', 'RRRR') AS result; |
|
|
SELECT TO_DATE('0', 'Y') AS result; |
SELECT TO_DATE('1', 'Y') AS result; |
SELECT TO_DATE('10', 'Y') AS result; |
|
|
SELECT TO_DATE('Sun', 'DY'); |
SELECT TO_DATE('sun', 'DY'); |
SELECT TO_DATE('xxx', 'DY'); |
SET STATEMENT timestamp = UNIX_TIMESTAMP('2025-12-19') FOR SELECT TO_DATE('FRI', 'DY'); |
|
|
SET timestamp = DEFAULT; |
|
|
CREATE TABLE t (d DATETIME, vd VARCHAR(32) AS (TO_DATE(d DEFAULT '2000-01-01' ON CONVERSION ERROR, 'YYYY-MM-DD'))); |
SHOW CREATE TABLE t; |
DROP TABLE t; |
|
|
This currently fails, see MDEV-38403
|
CREATE TABLE t (c GEOMETRYCOLLECTION); |
SELECT TO_DATE(c,'YYYY-MM-DD') FROM t; |
DROP TABLE t; |
Attachments
Issue Links
- is blocked by
-
MDEV-38403 Server crashes in Item_func_to_date::fix_length_and_dec upon using an invalid argument
-
- Open
-
- is caused by
-
MDEV-19683 Add support for Oracle TO_DATE()
-
- In Testing
-