UNSET
1 つ以上のシステム設定をグローバルまたはデフォルトのレベルと値に戻します。設定レベルの詳細については、設定レベル を参照してください。現在のすべての設定を表示するには、SHOW SETTINGS を使用します。
関連情報: SET
構文
-- Unset one setting
UNSET [ SESSION | GLOBAL ] <setting_name>
-- Unset multiple settings
UNSET [ SESSION | GLOBAL ] ( <setting_name>, <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 │
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘