Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.11, 11.4, 11.8, 12.3, 13.0, 13.1, 13.2
Description
--source include/have_partition.inc
|
 |
SET time_zone='+00:00'; |
# PARTITION BY HASH (v) refuses this column. LIST COLUMNS (v) must refuse it too, or keep the rows where they can be found |
--error 0,ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
|
CREATE TABLE t1 (ts TIMESTAMP, v INT AS (HOUR(ts)) VIRTUAL) PARTITION BY LIST COLUMNS (v) (PARTITION p0 VALUES IN (1), PARTITION p1 DEFAULT); |
if (!$mysql_errno) |
{
|
INSERT INTO t1 (ts) VALUES ('2000-01-01 01:00:00'); |
SET time_zone='+01:00'; |
--let $c= query_get_value(SELECT COUNT(*) AS c FROM t1 WHERE v=2, c, 1) |
if ($c != 1) |
{
|
--die The row with v=2 is not found by v=2 after a time_zone change. The time zone dependent v was accepted |
}
|
DROP TABLE t1; |
}
|
Leads to:
|
CS 13.1.0 da18481158c81ca94689702073c3e04aad85a6a3 (Debug, Clang 22.1.8-20260622) Build 18/08/2026 |
mysqltest: At line 14: The row with v=2 is not found by v=2 after a time_zone change. The time zone dependent v was accepted
|
Partitioning changes the query result. Without partitioning, v=2 finds the row after the same time_zone change. PARTITION BY HASH (v) on the same column gives ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR. PARTITION BY KEY (v) is accepted and misses the row in the same way. InnoDB and optimized builds give the same result.
From the code it seems that the check for a time zone dependent virtual column runs only for a partitioning expression. fix_fields_part_func() in sql/sql_partition.cc walks the expression with check_valid_arguments_processor, and Item_field::check_valid_arguments_processor() in sql/item.cc checks the expression of a virtual column. For KEY and COLUMNS partitioning, handle_list_of_fields() is called instead, and it does not run this check.
Attachments
Issue Links
- relates to
-
MDEV-7113 difference between check_vcol_func_processor and check_partition_func_processor
-
- Stalled
-
-
MDEV-41573 Partitioning by COLUMNS or KEY on a virtual column changes the query result after an ALTER TABLE changes its expression
-
- Open
-