📣新登場!TiDB Cloud BYOC、TiDB Cloud Filesystem、PostgreSQL-compatible TiDB Cloud Starter がパブリックプレビュー中。このページは自動翻訳されたものです。原文はこちらからご覧ください。

UNSET



1 つ以上のシステム設定をグローバルまたはデフォルトのレベルと値に戻します。設定レベルの詳細については、設定レベル を参照してください。現在のすべての設定を表示するには、SHOW SETTINGS を使用します。

関連情報: SET

構文

-- Unset one setting UNSET [ SESSION | GLOBAL ] <setting_name> -- Unset multiple settings UNSET [ SESSION | GLOBAL ] ( <setting_name>, <setting_name> ... )
パラメータ説明
SESSION設定にグローバルレベルの値がある場合、セッションレベルの上書きを削除してグローバル設定に戻します。設定がセッションレベルの値しか持たない場合は、デフォルト設定に戻します。
GLOBALグローバルレベルの設定を削除し、デフォルトレベルの値に戻します。
Lake-Query バージョン説明
[-∞, v1.2.605)デフォルトでは、UNSET <setting_name> は UNSET GLOBAL <setting_name> と同じです。
[v1.2.605, +∞]デフォルトでは、UNSET <setting_name> は UNSET SESSION <setting_name> と同じです。

例

この例では、UNSET GLOBAL を使用して timezone のグローバルレベル設定を削除し、デフォルトの値とレベルに戻します。

SHOW SETTINGS LIKE 'timezone'; ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ name │ value │ default │ range │ level │ description │ type │ ├──────────┼────────┼─────────┼─────────────────────────────────────────────────────────────────────┼─────────┼────────────────────┼────────┤ │ timezone │ UTC │ UTC │ ["Africa/Abidjan", "Africa/Accra", "Africa/Addis_Ababa", "Africa... │ DEFAULT │ Sets the timezone. │ String │ └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -- Sets timezone to 'Asia/Shanghai' at global level SET GLOBAL timezone = 'Asia/Shanghai'; SHOW SETTINGS LIKE 'timezone'; ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ name │ value │ default │ range │ level │ description │ type │ ├──────────┼───────────────┼─────────┼─────────────────────────────────────────────────────────────────────┼────────┼────────────────────┼────────┤ │ timezone │ Asia/Shanghai │ UTC │ ["Africa/Abidjan", "Africa/Accra", "Africa/Addis_Ababa", "Africa... │ GLOBAL │ Sets the timezone. │ String │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -- Removes the global-level setting for timezone UNSET GLOBAL timezone; SHOW SETTINGS LIKE 'timezone'; ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ name │ value │ default │ range │ level │ description │ type │ ├──────────┼────────┼─────────┼─────────────────────────────────────────────────────────────────────┼─────────┼────────────────────┼────────┤ │ timezone │ UTC │ UTC │ ["Africa/Abidjan", "Africa/Accra", "Africa/Addis_Ababa", "Africa... │ DEFAULT │ Sets the timezone. │ String │ └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

この例では、UNSET SESSION を使用して timezone のセッションレベル設定を削除し、グローバルレベル設定に戻します。

SHOW SETTINGS LIKE 'timezone'; ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ name │ value │ default │ range │ level │ description │ type │ ├──────────┼────────┼─────────┼─────────────────────────────────────────────────────────────────────┼─────────┼────────────────────┼────────┤ │ timezone │ UTC │ UTC │ ["Africa/Abidjan", "Africa/Accra", "Africa/Addis_Ababa", "Africa... │ DEFAULT │ Sets the timezone. │ String │ └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -- Sets timezone to 'Asia/Shanghai' at global level SET GLOBAL timezone = 'Asia/Shanghai'; SHOW SETTINGS LIKE 'timezone'; ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ name │ value │ default │ range │ level │ description │ type │ ├──────────┼───────────────┼─────────┼─────────────────────────────────────────────────────────────────────┼────────┼────────────────────┼────────┤ │ timezone │ Asia/Shanghai │ UTC │ ["Africa/Abidjan", "Africa/Accra", "Africa/Addis_Ababa", "Africa... │ GLOBAL │ Sets the timezone. │ String │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -- Set timezone to 'America/Santiago' in current session SET timezone = 'America/Santiago'; SHOW SETTINGS LIKE 'timezone'; ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ name │ value │ default │ range │ level │ description │ type │ ├──────────┼──────────────────┼─────────┼─────────────────────────────────────────────────────────────────────┼─────────┼────────────────────┼────────┤ │ timezone │ America/Santiago │ UTC │ ["Africa/Abidjan", "Africa/Accra", "Africa/Addis_Ababa", "Africa... │ SESSION │ Sets the timezone. │ String │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ UNSET SESSION timezone; SHOW SETTINGS LIKE 'timezone'; ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ name │ value │ default │ range │ level │ description │ type │ ├──────────┼───────────────┼─────────┼─────────────────────────────────────────────────────────────────────┼────────┼────────────────────┼────────┤ │ timezone │ Asia/Shanghai │ UTC │ ["Africa/Abidjan", "Africa/Accra", "Africa/Addis_Ababa", "Africa... │ GLOBAL │ Sets the timezone. │ String │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

この例では、UNSET SESSION を使用して timezone のセッションレベル設定を削除し、セッションレベル設定に戻します。

SHOW SETTINGS LIKE 'timezone'; ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ name │ value │ default │ range │ level │ description │ type │ ├──────────┼───────────────┼─────────┼─────────────────────────────────────────────────────────────────────┼────────┼────────────────────┼────────┤ │ timezone │ Asia/Shanghai │ UTC │ ["Africa/Abidjan", "Africa/Accra", "Africa/Addis_Ababa", "Africa... │ GLOBAL │ Sets the timezone. │ String │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ UNSET timezone; SHOW SETTINGS LIKE 'timezone'; ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ name │ value │ default │ range │ level │ description │ type │ ├──────────┼────────┼─────────┼─────────────────────────────────────────────────────────────────────┼─────────┼────────────────────┼────────┤ │ timezone │ UTC │ UTC │ ["Africa/Abidjan", "Africa/Accra", "Africa/Addis_Ababa", "Africa... │ DEFAULT │ Sets the timezone. │ String │ └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

このページは役に立ちましたか?