MySQL Variables updatable_views_with_limit 数据库 参数变量解释及正确配置使用

本站中文解释

updatable_views_with_limit参数控制MySQL是否允许在有限制的情况下更新可更新视图(UPDATABLE VIEWS)。

默认情况下,MySQL不允许在有限制的情况下更新可更新视图。如果需要允许在有限制的情况下更新可更新视图,则可以通过以下方式设置updatable_views_with_limit参数:

将该参数设置为1或ON:

SET GLOBAL updatable_views_with_limit=1;

或者可以将该参数设置为0或OFF:

SET GLOBAL updatable_views_with_limit=0;

官方英文解释

updatable_views_with_limit

Command-Line Format --updatable-views-with-limit[={OFF|ON}]
System Variable updatable_views_with_limit
Scope Global, Session
Dynamic Yes
Type Boolean
Default Value 1

This variable controls whether updates to a view can be made
when the view does not contain all columns of the primary key
defined in the underlying table, if the update statement
contains a LIMIT clause. (Such updates
often are generated by GUI tools.) An update is an
UPDATE or
DELETE statement. Primary key
here means a PRIMARY KEY, or a
UNIQUE index in which no column can contain
NULL.

The variable can have two values:

  • 1 or YES: Issue a
    warning only (not an error message). This is the default
    value.

  • 0 or NO: Prohibit
    the update.


数据运维技术 » MySQL Variables updatable_views_with_limit 数据库 参数变量解释及正确配置使用