8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

MySQL 8.4 参考手册 / 26 分区 / 26.6 分区的约束和限制 / 26.6.3 与函数相关的分区限制
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 37%

26.6.3 与函数相关的分区限制26.6.3 Partitioning Limitations Relating to Functions

本节讨论 MySQL 分区中与用于分区表达式的函数相关的限制。This section discusses limitations in MySQL Partitioning relating specifically to functions used in partitioning expressions.

只有下列列表中显示的 MySQL 函数允许用于分区表达式:Only the MySQL functions shown in the following list are allowed in partitioning expressions:

在 MySQL 8.4 中,分区修剪支持 TO_DAYS()、TO_SECONDS()、YEAR() 和 UNIX_TIMESTAMP() 函数。有关更多信息,请参见 第 26.4 节,“分区修剪”。In MySQL 8.4, partition pruning is supported for the TO_DAYS(), TO_SECONDS(), YEAR(), and UNIX_TIMESTAMP() functions. See Section 26.4, “Partition Pruning”, for more information.

CEILING() 和 FLOOR()。 这些函数只有在传入精确数值类型的参数时才返回整数,例如 INT 类型或 DECIMAL。这意味着,例如,以下 CREATE TABLE 语句会因错误而失败,如下所示:CEILING() and FLOOR().  Each of these functions returns an integer only if it is passed an argument of an exact numeric type, such as one of the INT types or DECIMAL. This means, for example, that the following CREATE TABLE statement fails with an error, as shown here:

mysql> CREATE TABLE t (c FLOAT) PARTITION BY LIST( FLOOR(c) )(
    ->     PARTITION p0 VALUES IN (1,3,5),
    ->     PARTITION p1 VALUES IN (2,4,6)
    -> );
ERROR 1490 (HY000): The PARTITION function returns the wrong type

带有 WEEK 指定符的 EXTRACT() 函数。 当 EXTRACT() 函数以 EXTRACT(WEEK FROM col) 的形式使用时,其返回值取决于 default_week_format 系统变量的值。因此,当指定单位为 WEEK 时,不允许将 EXTRACT() 用作分区函数。(Bug #54483)EXTRACT() function with WEEK specifier.  The value returned by the EXTRACT() function, when used as EXTRACT(WEEK FROM col), depends on the value of the default_week_format system variable. For this reason, EXTRACT() is not permitted as a partitioning function when it specifies the unit as WEEK. (Bug #54483)

有关这些函数的返回类型的更多信息,请参见第 14.6.2 节,“数学函数”,以及第 13.1 节,“数值数据类型”。See Section 14.6.2, “Mathematical Functions”, for more information about the return types of these functions, as well as Section 13.1, “Numeric Data Types”.