{"Entry":{"collection":"sql","key":"alter-system","name":"ALTER SYSTEM","aliases":["altersystem"],"metadata":{"aliases":["altersystem"],"changed_in":["11"],"changes":[{"from":"9.3","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"added","synopsis":null,"to":"9.4"},{"from":"9.5","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description","parameters","notes","examples"],"removed":[]},"status":"changed","synopsis":null,"to":"9.6"},{"from":"10","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters"],"removed":[]},"status":"changed","synopsis":{"added":["ALTER SYSTEM SET configuration_parameter { TO | = } { value [, ...] | DEFAULT }"],"removed":["ALTER SYSTEM SET configuration_parameter { TO | = } { value | 'value' | DEFAULT }"]},"to":"11"},{"from":"13","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters","notes"],"removed":[]},"status":"changed","synopsis":null,"to":"14"},{"from":"14","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description"],"removed":[]},"status":"changed","synopsis":null,"to":"15"},{"from":"16","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters","notes"],"removed":[]},"status":"changed","synopsis":null,"to":"17"},{"from":"18","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters","examples"],"removed":[]},"status":"changed","synopsis":null,"to":"19"}],"content_hash":"02a85f604ef9a3fe640a5aaba5ee26782966ce4b60aa8b0230f9fd1e8d9f91ca","derived_content_hash":"5b05a2fe4abcb06f5ebe06c9f37cbb1eb88d808ccd8778529e7b0fe5e2baebcc","editorial":{},"first_version":"9.4","group":"session","imported_at":"2026-09-30T17:43:39.549528+08:00","last_version":"20","name":"ALTER SYSTEM","object":"SYSTEM","position":14007,"present_in":["9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"purpose":"change a server configuration parameter","purpose_zh":"","related":["set","show"],"repair_provenance":{"original_source_revision":"a709ab85","receipt_sha256":"45c2fb7824034e8f56b245735387c38b8031d7848a8fd2a1c9b6911c77c17683","repair":"wiki-repair-20261023"},"slug":"alter-system","source_rev":"wiki-repair-20261023:7908127cf36dba8d1e3cb0cc1e4c1fd8cf98da2f5d903dc679740fead419dd86","synopsis":"ALTER SYSTEM SET configuration_parameter { TO | = } { value [, ...] | DEFAULT }\n\nALTER SYSTEM RESET configuration_parameter\nALTER SYSTEM RESET ALL","verb":"ALTER"}},"Definition":{"Collection":"sql","Key":"alter-system","SourceDatabase":"center","Version":"18","SourceTable":"sqlcmd","SourceKey":"alter-system","SourceRevision":"wiki-repair-20261023:7908127cf36dba8d1e3cb0cc1e4c1fd8cf98da2f5d903dc679740fead419dd86","Facts":{"anchor":"SQL-ALTERSYSTEM","description_zh":"更改服务器配置参数","description_zh_html":"\u003cpre\u003eALTER SYSTEM SET configuration_parameter { TO | = } { value [, ...] | DEFAULT }\n\nALTER SYSTEM RESET configuration_parameter\nALTER SYSTEM RESET ALL\u003c/pre\u003e\u003csection\u003e\u003ch2\u003e描述\u003c/h2\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003eALTER SYSTEM\u003c/code\u003e 用于更改整个数据库集簇范围内的服务器配置参数。与传统的手工编辑\n   \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e 文件相比，它可能更方便。\u003ccode class=\"command\"\u003eALTER SYSTEM\u003c/code\u003e 会把给定的参数设置写入\n   \u003ccode class=\"filename\"\u003epostgresql.auto.conf\u003c/code\u003e 文件；除读取\n   \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e 之外，系统还会读取该文件。把参数设置为\n   \u003ccode class=\"literal\"\u003eDEFAULT\u003c/code\u003e，或者使用 \u003ccode class=\"command\"\u003eRESET\u003c/code\u003e 变体，会从 \u003ccode class=\"filename\"\u003epostgresql.auto.conf\u003c/code\u003e 文件中移除相应的配置项。使用 \u003ccode class=\"literal\"\u003eRESET ALL\u003c/code\u003e 可以移除所有这类配置项。\n  \u003c/p\u003e\u003cp\u003e\n   用 \u003ccode class=\"command\"\u003eALTER SYSTEM\u003c/code\u003e 设置的值，会在下一次重新加载服务器配置后生效；对于那些只能在服务器启动时更改的参数，则会在下一次服务器重启后生效。重新加载服务器配置可以通过调用 SQL 函数\n   \u003ccode class=\"function\"\u003epg_reload_conf()\u003c/code\u003e、运行\n   \u003ccode class=\"literal\"\u003epg_ctl reload\u003c/code\u003e，或者向主服务器进程发送\n   \u003cspan class=\"systemitem\"\u003eSIGHUP\u003c/span\u003e 信号来触发。\n  \u003c/p\u003e\u003cp\u003e\n   只有超级用户以及在某个参数上被授予 \u003ccode class=\"literal\"\u003eALTER SYSTEM\u003c/code\u003e\n   权限的用户，才能使用 \u003ccode class=\"command\"\u003eALTER SYSTEM\u003c/code\u003e 更改该参数。另外，由于该命令直接作用于文件系统且不能回滚，因此不允许在事务块或函数内部使用。\n  \u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e参数\u003c/h2\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003econfiguration_parameter\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      一个可设置的配置参数名称。可用参数见\u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config.html\" title=\"第 19 章 服务器配置\"\u003e第 19 章\u003c/a\u003e。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      参数的新值。根据具体参数的要求，值可以指定为字符串常量、标识符、数字，或这些内容构成的逗号分隔列表。既不是数字也不是有效标识符的值必须加引号。可以写入 \u003ccode class=\"literal\"\u003eDEFAULT\u003c/code\u003e，以指定从\n      \u003ccode class=\"filename\"\u003epostgresql.auto.conf\u003c/code\u003e 中删除该参数及其值。\n     \u003c/p\u003e\u003cp\u003e\n      对于某些接受列表的参数，带引号的值会生成带双引号的输出，以保留空白和逗号；对于另一些参数，则必须在单引号字符串内部使用双引号才能达到这种效果。\n     \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e注解\u003c/h2\u003e\u003cp\u003e\n   不能用这个命令来设置 \u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-file-locations.html#GUC-DATA-DIRECTORY\"\u003edata_directory\u003c/a\u003e、\u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-compatible.html#GUC-ALLOW-ALTER-SYSTEM\"\u003eallow_alter_system\u003c/a\u003e，以及不允许出现在\n   \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e 中的参数（例如\u003ca class=\"link\" href=\"/zh/docs/18/runtime-config-preset.html\" title=\"19.15. 预置选项\"\u003e预置选项\u003c/a\u003e）。\n  \u003c/p\u003e\u003cp\u003e\n   关于设置这些参数的其他方法，见\u003ca class=\"xref\" href=\"/zh/docs/18/config-setting.html\" title=\"19.1. 设置参数\"\u003e第 19.1 节\u003c/a\u003e。\n  \u003c/p\u003e\u003cp\u003e\n   可以通过把 \u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-compatible.html#GUC-ALLOW-ALTER-SYSTEM\"\u003eallow_alter_system\u003c/a\u003e 设置为\n   \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e 来禁用 \u003ccode class=\"literal\"\u003eALTER SYSTEM\u003c/code\u003e，但这并不是一种安全机制（该参数的文档中对此有详细说明）。\n  \u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e示例\u003c/h2\u003e\u003cp\u003e\n   设置 \u003ccode class=\"literal\"\u003ewal_level\u003c/code\u003e：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\nALTER SYSTEM SET wal_level = replica;\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   撤销该设置，恢复为 \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e 中生效的设置：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\nALTER SYSTEM RESET wal_level;\n\u003c/pre\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e兼容性\u003c/h2\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003eALTER SYSTEM\u003c/code\u003e 语句是一种\n   \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 扩展。\n  \u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e另见\u003c/h2\u003e\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/zh/docs/18/sql-set.html\" title=\"SET\"\u003e\u003cspan class=\"refentrytitle\"\u003eSET\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/zh/docs/18/sql-show.html\" title=\"SHOW\"\u003e\u003cspan class=\"refentrytitle\"\u003eSHOW\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/section\u003e","file":"sql-altersystem.html","lang":"en","name":"ALTER SYSTEM","purpose":"change a server configuration parameter","purpose_zh":"更改服务器配置参数","related":["set","show"],"sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eALTER SYSTEM\u003c/code\u003e is used for changing server configuration parameters across the entire database cluster. It can be more convenient than the traditional method of manually editing the \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e file. \u003ccode class=\"command\"\u003eALTER SYSTEM\u003c/code\u003e writes the given parameter setting to the \u003ccode class=\"filename\"\u003epostgresql.auto.conf\u003c/code\u003e file, which is read in addition to \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e. Setting a parameter to \u003ccode class=\"literal\"\u003eDEFAULT\u003c/code\u003e, or using the \u003ccode class=\"command\"\u003eRESET\u003c/code\u003e variant, removes that configuration entry from the \u003ccode class=\"filename\"\u003epostgresql.auto.conf\u003c/code\u003e file. Use \u003ccode class=\"literal\"\u003eRESET ALL\u003c/code\u003e to remove all such configuration entries.\u003c/p\u003e\u003cp\u003eValues set with \u003ccode class=\"command\"\u003eALTER SYSTEM\u003c/code\u003e will be effective after the next server configuration reload, or after the next server restart in the case of parameters that can only be changed at server start. A server configuration reload can be commanded by calling the SQL function \u003ccode class=\"function\"\u003epg_reload_conf()\u003c/code\u003e, running \u003ccode class=\"literal\"\u003epg_ctl reload\u003c/code\u003e, or sending a \u003cspan class=\"systemitem\"\u003eSIGHUP\u003c/span\u003e signal to the main server process.\u003c/p\u003e\u003cp\u003eOnly superusers and users granted \u003ccode class=\"literal\"\u003eALTER SYSTEM\u003c/code\u003e privilege on a parameter can change it using \u003ccode class=\"command\"\u003eALTER SYSTEM\u003c/code\u003e. Also, since this command acts directly on the file system and cannot be rolled back, it is not allowed inside a transaction block or function.\u003c/p\u003e","key":"description","title":"Description"},{"html":"\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003econfiguration_parameter\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eName of a settable configuration parameter. Available parameters are documented in \u003ca href=\"/docs/18/runtime-config.html\" title=\"Chapter 19. Server Configuration\"\u003eChapter 19\u003c/a\u003e.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eNew value of the parameter. Values can be specified as string constants, identifiers, numbers, or comma-separated lists of these, as appropriate for the particular parameter. Values that are neither numbers nor valid identifiers must be quoted. \u003ccode class=\"literal\"\u003eDEFAULT\u003c/code\u003e can be written to specify removing the parameter and its value from \u003ccode class=\"filename\"\u003epostgresql.auto.conf\u003c/code\u003e.\u003c/p\u003e\u003cp\u003eFor some list-accepting parameters, quoted values will produce double-quoted output to preserve whitespace and commas; for others, double-quotes must be used inside single-quoted strings to get this effect.\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","key":"parameters","title":"Parameters"},{"html":"\u003cp\u003eThis command can't be used to set \u003ca href=\"/docs/18/runtime-config-file-locations.html#GUC-DATA-DIRECTORY\"\u003edata_directory\u003c/a\u003e, \u003ca href=\"/docs/18/runtime-config-compatible.html#GUC-ALLOW-ALTER-SYSTEM\"\u003eallow_alter_system\u003c/a\u003e, nor parameters that are not allowed in \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e (e.g., \u003ca href=\"/docs/18/runtime-config-preset.html\" title=\"19.15. Preset Options\"\u003epreset options\u003c/a\u003e).\u003c/p\u003e\u003cp\u003eSee \u003ca href=\"/docs/18/config-setting.html\" title=\"19.1. Setting Parameters\"\u003eSection 19.1\u003c/a\u003e for other ways to set the parameters.\u003c/p\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003eALTER SYSTEM\u003c/code\u003e can be disabled by setting \u003ca href=\"/docs/18/runtime-config-compatible.html#GUC-ALLOW-ALTER-SYSTEM\"\u003eallow_alter_system\u003c/a\u003e to \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e, but this is not a security mechanism (as explained in detail in the documentation for this parameter).\u003c/p\u003e","key":"notes","title":"Notes"},{"html":"\u003cp\u003eSet the \u003ccode class=\"literal\"\u003ewal_level\u003c/code\u003e:\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eALTER SYSTEM SET wal_level = replica;\n\u003c/pre\u003e\u003cp\u003eUndo that, restoring whatever setting was effective in \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e:\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eALTER SYSTEM RESET wal_level;\n\u003c/pre\u003e","key":"examples","title":"Examples"},{"html":"\u003cp\u003eThe \u003ccode class=\"command\"\u003eALTER SYSTEM\u003c/code\u003e statement is a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e extension.\u003c/p\u003e","key":"compatibility","title":"Compatibility"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/set/?v=18\" title=\"SET\"\u003e\u003cspan class=\"refentrytitle\"\u003eSET\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/show/?v=18\" title=\"SHOW\"\u003e\u003cspan class=\"refentrytitle\"\u003eSHOW\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","slug":"18","synopsis_html":"ALTER SYSTEM SET \u003cem class=\"replaceable\"\u003e\u003ccode\u003econfiguration_parameter\u003c/code\u003e\u003c/em\u003e { TO | = } { \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e [, ...] | DEFAULT }\n\nALTER SYSTEM RESET \u003cem class=\"replaceable\"\u003e\u003ccode\u003econfiguration_parameter\u003c/code\u003e\u003c/em\u003e\nALTER SYSTEM RESET ALL","synopsis_text":"ALTER SYSTEM SET configuration_parameter { TO | = } { value [, ...] | DEFAULT }\n\nALTER SYSTEM RESET configuration_parameter\nALTER SYSTEM RESET ALL","translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/sql-altersystem.html","sha256":"752092f142ca24f103d3d878c68752fdb43b5e61ab420867be174e165b955b2a"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"zh_from":"same-version-pgdoc"},"ManualEvidence":{},"MeasuredEvidence":{}},"Text":{"Collection":"sql","Key":"alter-system","SourceDatabase":"center","Version":"18","Locale":"en","Title":"ALTER SYSTEM","Summary":"change a server configuration parameter","BodyHTML":"\u003cpre\u003eALTER SYSTEM SET configuration_parameter { TO | = } { value [, ...] | DEFAULT }\n\nALTER SYSTEM RESET configuration_parameter\nALTER SYSTEM RESET ALL\u003c/pre\u003e\u003csection\u003e\u003ch2\u003eDescription\u003c/h2\u003e\u003cp\u003e\u003ccode\u003eALTER SYSTEM\u003c/code\u003e is used for changing server configuration parameters across the entire database cluster. It can be more convenient than the traditional method of manually editing the \u003ccode\u003epostgresql.conf\u003c/code\u003e file. \u003ccode\u003eALTER SYSTEM\u003c/code\u003e writes the given parameter setting to the \u003ccode\u003epostgresql.auto.conf\u003c/code\u003e file, which is read in addition to \u003ccode\u003epostgresql.conf\u003c/code\u003e. Setting a parameter to \u003ccode\u003eDEFAULT\u003c/code\u003e, or using the \u003ccode\u003eRESET\u003c/code\u003e variant, removes that configuration entry from the \u003ccode\u003epostgresql.auto.conf\u003c/code\u003e file. Use \u003ccode\u003eRESET ALL\u003c/code\u003e to remove all such configuration entries.\u003c/p\u003e\u003cp\u003eValues set with \u003ccode\u003eALTER SYSTEM\u003c/code\u003e will be effective after the next server configuration reload, or after the next server restart in the case of parameters that can only be changed at server start. A server configuration reload can be commanded by calling the SQL function \u003ccode\u003epg_reload_conf()\u003c/code\u003e, running \u003ccode\u003epg_ctl reload\u003c/code\u003e, or sending a \u003cspan\u003eSIGHUP\u003c/span\u003e signal to the main server process.\u003c/p\u003e\u003cp\u003eOnly superusers and users granted \u003ccode\u003eALTER SYSTEM\u003c/code\u003e privilege on a parameter can change it using \u003ccode\u003eALTER SYSTEM\u003c/code\u003e. Also, since this command acts directly on the file system and cannot be rolled back, it is not allowed inside a transaction block or function.\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eParameters\u003c/h2\u003e\u003cdiv\u003e\u003cdl\u003e\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003econfiguration_parameter\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eName of a settable configuration parameter. Available parameters are documented in \u003ca href=\"/docs/18/runtime-config.html\" rel=\"nofollow\"\u003eChapter 19\u003c/a\u003e.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eNew value of the parameter. Values can be specified as string constants, identifiers, numbers, or comma-separated lists of these, as appropriate for the particular parameter. Values that are neither numbers nor valid identifiers must be quoted. \u003ccode\u003eDEFAULT\u003c/code\u003e can be written to specify removing the parameter and its value from \u003ccode\u003epostgresql.auto.conf\u003c/code\u003e.\u003c/p\u003e\u003cp\u003eFor some list-accepting parameters, quoted values will produce double-quoted output to preserve whitespace and commas; for others, double-quotes must be used inside single-quoted strings to get this effect.\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eNotes\u003c/h2\u003e\u003cp\u003eThis command can\u0026#39;t be used to set \u003ca href=\"/docs/18/runtime-config-file-locations.html#GUC-DATA-DIRECTORY\" rel=\"nofollow\"\u003edata_directory\u003c/a\u003e, \u003ca href=\"/docs/18/runtime-config-compatible.html#GUC-ALLOW-ALTER-SYSTEM\" rel=\"nofollow\"\u003eallow_alter_system\u003c/a\u003e, nor parameters that are not allowed in \u003ccode\u003epostgresql.conf\u003c/code\u003e (e.g., \u003ca href=\"/docs/18/runtime-config-preset.html\" rel=\"nofollow\"\u003epreset options\u003c/a\u003e).\u003c/p\u003e\u003cp\u003eSee \u003ca href=\"/docs/18/config-setting.html\" rel=\"nofollow\"\u003eSection 19.1\u003c/a\u003e for other ways to set the parameters.\u003c/p\u003e\u003cp\u003e\u003ccode\u003eALTER SYSTEM\u003c/code\u003e can be disabled by setting \u003ca href=\"/docs/18/runtime-config-compatible.html#GUC-ALLOW-ALTER-SYSTEM\" rel=\"nofollow\"\u003eallow_alter_system\u003c/a\u003e to \u003ccode\u003eoff\u003c/code\u003e, but this is not a security mechanism (as explained in detail in the documentation for this parameter).\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eExamples\u003c/h2\u003e\u003cp\u003eSet the \u003ccode\u003ewal_level\u003c/code\u003e:\u003c/p\u003e\u003cpre\u003eALTER SYSTEM SET wal_level = replica;\n\u003c/pre\u003e\u003cp\u003eUndo that, restoring whatever setting was effective in \u003ccode\u003epostgresql.conf\u003c/code\u003e:\u003c/p\u003e\u003cpre\u003eALTER SYSTEM RESET wal_level;\n\u003c/pre\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eCompatibility\u003c/h2\u003e\u003cp\u003eThe \u003ccode\u003eALTER SYSTEM\u003c/code\u003e statement is a \u003cspan\u003ePostgreSQL\u003c/span\u003e extension.\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan\u003e\u003ca href=\"/wiki/sql/set/?v=18\" title=\"SET\" rel=\"nofollow\"\u003e\u003cspan\u003eSET\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/show/?v=18\" title=\"SHOW\" rel=\"nofollow\"\u003e\u003cspan\u003eSHOW\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/section\u003e","SourceRevision":"wiki-repair-20261023:7908127cf36dba8d1e3cb0cc1e4c1fd8cf98da2f5d903dc679740fead419dd86","ContentHash":"deb649626a377dfa9edf13df2cfcad291773ddc04c0643817dc52de3a0c28935","Payload":{"related":["set","show"],"sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eALTER SYSTEM\u003c/code\u003e is used for changing server configuration parameters across the entire database cluster. It can be more convenient than the traditional method of manually editing the \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e file. \u003ccode class=\"command\"\u003eALTER SYSTEM\u003c/code\u003e writes the given parameter setting to the \u003ccode class=\"filename\"\u003epostgresql.auto.conf\u003c/code\u003e file, which is read in addition to \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e. Setting a parameter to \u003ccode class=\"literal\"\u003eDEFAULT\u003c/code\u003e, or using the \u003ccode class=\"command\"\u003eRESET\u003c/code\u003e variant, removes that configuration entry from the \u003ccode class=\"filename\"\u003epostgresql.auto.conf\u003c/code\u003e file. Use \u003ccode class=\"literal\"\u003eRESET ALL\u003c/code\u003e to remove all such configuration entries.\u003c/p\u003e\u003cp\u003eValues set with \u003ccode class=\"command\"\u003eALTER SYSTEM\u003c/code\u003e will be effective after the next server configuration reload, or after the next server restart in the case of parameters that can only be changed at server start. A server configuration reload can be commanded by calling the SQL function \u003ccode class=\"function\"\u003epg_reload_conf()\u003c/code\u003e, running \u003ccode class=\"literal\"\u003epg_ctl reload\u003c/code\u003e, or sending a \u003cspan class=\"systemitem\"\u003eSIGHUP\u003c/span\u003e signal to the main server process.\u003c/p\u003e\u003cp\u003eOnly superusers and users granted \u003ccode class=\"literal\"\u003eALTER SYSTEM\u003c/code\u003e privilege on a parameter can change it using \u003ccode class=\"command\"\u003eALTER SYSTEM\u003c/code\u003e. Also, since this command acts directly on the file system and cannot be rolled back, it is not allowed inside a transaction block or function.\u003c/p\u003e","key":"description","title":"Description"},{"html":"\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003econfiguration_parameter\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eName of a settable configuration parameter. Available parameters are documented in \u003ca href=\"/docs/18/runtime-config.html\" title=\"Chapter 19. Server Configuration\"\u003eChapter 19\u003c/a\u003e.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eNew value of the parameter. Values can be specified as string constants, identifiers, numbers, or comma-separated lists of these, as appropriate for the particular parameter. Values that are neither numbers nor valid identifiers must be quoted. \u003ccode class=\"literal\"\u003eDEFAULT\u003c/code\u003e can be written to specify removing the parameter and its value from \u003ccode class=\"filename\"\u003epostgresql.auto.conf\u003c/code\u003e.\u003c/p\u003e\u003cp\u003eFor some list-accepting parameters, quoted values will produce double-quoted output to preserve whitespace and commas; for others, double-quotes must be used inside single-quoted strings to get this effect.\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","key":"parameters","title":"Parameters"},{"html":"\u003cp\u003eThis command can't be used to set \u003ca href=\"/docs/18/runtime-config-file-locations.html#GUC-DATA-DIRECTORY\"\u003edata_directory\u003c/a\u003e, \u003ca href=\"/docs/18/runtime-config-compatible.html#GUC-ALLOW-ALTER-SYSTEM\"\u003eallow_alter_system\u003c/a\u003e, nor parameters that are not allowed in \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e (e.g., \u003ca href=\"/docs/18/runtime-config-preset.html\" title=\"19.15. Preset Options\"\u003epreset options\u003c/a\u003e).\u003c/p\u003e\u003cp\u003eSee \u003ca href=\"/docs/18/config-setting.html\" title=\"19.1. Setting Parameters\"\u003eSection 19.1\u003c/a\u003e for other ways to set the parameters.\u003c/p\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003eALTER SYSTEM\u003c/code\u003e can be disabled by setting \u003ca href=\"/docs/18/runtime-config-compatible.html#GUC-ALLOW-ALTER-SYSTEM\"\u003eallow_alter_system\u003c/a\u003e to \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e, but this is not a security mechanism (as explained in detail in the documentation for this parameter).\u003c/p\u003e","key":"notes","title":"Notes"},{"html":"\u003cp\u003eSet the \u003ccode class=\"literal\"\u003ewal_level\u003c/code\u003e:\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eALTER SYSTEM SET wal_level = replica;\n\u003c/pre\u003e\u003cp\u003eUndo that, restoring whatever setting was effective in \u003ccode class=\"filename\"\u003epostgresql.conf\u003c/code\u003e:\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eALTER SYSTEM RESET wal_level;\n\u003c/pre\u003e","key":"examples","title":"Examples"},{"html":"\u003cp\u003eThe \u003ccode class=\"command\"\u003eALTER SYSTEM\u003c/code\u003e statement is a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e extension.\u003c/p\u003e","key":"compatibility","title":"Compatibility"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/set/?v=18\" title=\"SET\"\u003e\u003cspan class=\"refentrytitle\"\u003eSET\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/show/?v=18\" title=\"SHOW\"\u003e\u003cspan class=\"refentrytitle\"\u003eSHOW\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","synopsis_html":"ALTER SYSTEM SET \u003cem class=\"replaceable\"\u003e\u003ccode\u003econfiguration_parameter\u003c/code\u003e\u003c/em\u003e { TO | = } { \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e [, ...] | DEFAULT }\n\nALTER SYSTEM RESET \u003cem class=\"replaceable\"\u003e\u003ccode\u003econfiguration_parameter\u003c/code\u003e\u003c/em\u003e\nALTER SYSTEM RESET ALL","synopsis_text":"ALTER SYSTEM SET configuration_parameter { TO | = } { value [, ...] | DEFAULT }\n\nALTER SYSTEM RESET configuration_parameter\nALTER SYSTEM RESET ALL"}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
