{"Entry":{"collection":"psql","key":"cmd-73-65-74-65-6e-76","name":"\\setenv","aliases":["\\setenv"],"metadata":{"aliases":["\\setenv"],"category":"Scripting and assistance","content_hash":"4f47dcc753864895dc25ee02f9d64cd1265493e6f1cade7625b2c2e3ab1f1067","derived_content_hash":"8725c90614569b2fd3487ef62338c576da6cd9fe45b94afab448c49b84a19c01","documentation_refresh":{"batch":"20261113","original_source_rev":"","versions":{"14":"14.25","15":"15.20","16":"16.16","17":"17.12","18":"18.7","19":"19rc2"}},"imported_at":"2026-09-30T00:40:45.187923+08:00","name":"\\setenv","name_zh":"","slug":"cmd-73-65-74-65-6e-76","summary":"Sets the environment variable name to value , or if the value is not supplied, unsets the environment variable. Example:"}},"Definition":{"Collection":"psql","Key":"cmd-73-65-74-65-6e-76","SourceDatabase":"center","Version":"18","SourceTable":"psql_command","SourceKey":"cmd-73-65-74-65-6e-76","SourceRevision":"1b2d62b4845aa46374f2cb680f95d3392322cc8128646992ae4e18d0e7084915","Facts":{"command":"\\setenv","comparison_data":{"definition":"Sets the environment variable name to value , or if the value is not supplied, unsets the environment variable. Example: testdb=\u003e \\setenv PAGER less testdb=\u003e \\setenv LESS -imx4F","modifiers":[],"signature":"\\setenv name [ value ]","spellings":["\\setenv"]},"comparison_hash":"7e81cc87e53bce6d6f95285d823c8453d1eae775a0b9e8b2497638c7089eef0a","description":["Sets the environment variable name to value , or if the value is not supplied, unsets the environment variable. Example:"],"description_zh":"设置环境变量 name 为 value ，或者如果未提供 value ，则取消设置环境变量。示例：","description_zh_html":"\u003cdd\u003e\u003cp\u003e\n        设置环境变量 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e 为 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e，或者如果未提供 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e，则取消设置环境变量。示例：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\setenv PAGER less\u003c/code\u003e\u003c/strong\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\setenv LESS -imx4F\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003c/dd\u003e","documentation_revision":{"inputs":[{"file":"app-psql.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"af50448485df02bdef2b72b8347192ba029c7082b8d0392ecb17db44ad533aaf","version":"18.7"},{"file":"app-psql.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"cb475c53a16d9e06358f5e6c9c5649645db92568cfd319f230c62c9f57ae090b","version":"18.7"}],"release":"18.7","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"},"facts":[{"label":"Client","value":"psql 18.7"},{"label":"Case-sensitive spelling","value":"\\setenv"}],"facts_zh":[{"label":"客户端","value":"psql 18.7"},{"label":"区分大小写的写法","value":"\\setenv"}],"localization":{"documentation_release":"18.7","language":"en","source_language":"en","source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552","status":"same-version-reviewed-manual"},"manual_html":"\u003cdiv\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-SETENV\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\setenv \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the environment variable \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e to \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e, or if the\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is\n        not supplied, unsets the environment variable. Example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\setenv PAGER less\u003c/code\u003e\u003c/strong\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\setenv LESS -imx4F\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","manual_path":"app-psql.html#APP-PSQL-META-COMMAND-SETENV","modifiers":[],"related":[{"label":"psql command-line options and complete manual","url":"/wiki/tool/psql/?v=18"}],"related_zh":[{"label":"psql 命令行选项及完整手册","url":"/wiki/tool/psql/?v=18"}],"release":{"channel":"stable","evidence_kind":"English manual and source declarations","label":"18.7","major":"18","manifest":{"major":"18","release":"18.7","source_sha256":"441dfae4280cae3e0425e5f876f80559fb0731c140f1aae22b3e5a54d0411bfd","source_url":"https://ftp.postgresql.org/pub/source/v18.7/postgresql-18.7.tar.bz2"},"ref":"https://ftp.postgresql.org/pub/source/v18.7/postgresql-18.7.tar.bz2","revision":"1b2d62b4845aa46374f2cb680f95d3392322cc8128646992ae4e18d0e7084915","source_sha256":"441dfae4280cae3e0425e5f876f80559fb0731c140f1aae22b3e5a54d0411bfd"},"sections":[],"sections_zh":[],"signature":"\\setenv name [ value ]","sources":[{"anchor":"APP-PSQL-META-COMMAND-SETENV","file":"app-psql.html","label":"18.7 English manual · app-psql.html","sha256":"af50448485df02bdef2b72b8347192ba029c7082b8d0392ecb17db44ad533aaf","url":"/docs/18/app-psql.html#APP-PSQL-META-COMMAND-SETENV"}],"spellings":["\\setenv"],"tables":[{"columns":[{"key":"command","label":"Command"},{"key":"modifiers","label":"Documented suffix modifiers"}],"key":"spellings","rows":[{"command":{"text":"\\setenv","url":"/wiki/psql/cmd-73-65-74-65-6e-76/?v=18"},"modifiers":"None listed in this signature"}],"title":"Spellings in this manual definition"}],"tables_zh":[{"columns":[{"key":"command","label":"命令"},{"key":"modifiers","label":"手册中的后缀修饰符"}],"key":"spellings","rows":[{"command":{"text":"\\setenv","url":"/wiki/psql/cmd-73-65-74-65-6e-76/?v=18"},"modifiers":"此语法签名未列出"}],"title":"本版手册中的写法"}],"zh_from":"same-version-manual"},"ManualEvidence":{"manual_path":"app-psql.html#APP-PSQL-META-COMMAND-SETENV","release":{"channel":"stable","evidence_kind":"English manual and source declarations","label":"18.7","major":"18","manifest":{"major":"18","release":"18.7","source_sha256":"441dfae4280cae3e0425e5f876f80559fb0731c140f1aae22b3e5a54d0411bfd","source_url":"https://ftp.postgresql.org/pub/source/v18.7/postgresql-18.7.tar.bz2"},"ref":"https://ftp.postgresql.org/pub/source/v18.7/postgresql-18.7.tar.bz2","revision":"1b2d62b4845aa46374f2cb680f95d3392322cc8128646992ae4e18d0e7084915","source_sha256":"441dfae4280cae3e0425e5f876f80559fb0731c140f1aae22b3e5a54d0411bfd"},"sources":[{"anchor":"APP-PSQL-META-COMMAND-SETENV","file":"app-psql.html","label":"18.7 English manual · app-psql.html","sha256":"af50448485df02bdef2b72b8347192ba029c7082b8d0392ecb17db44ad533aaf","url":"/docs/18/app-psql.html#APP-PSQL-META-COMMAND-SETENV"}]},"MeasuredEvidence":{}},"Text":{"Collection":"psql","Key":"cmd-73-65-74-65-6e-76","SourceDatabase":"center","Version":"18","Locale":"en","Title":"\\setenv","Summary":"Sets the environment variable name to value , or if the value is not supplied, unsets the environment variable. Example:","BodyHTML":"\u003cdiv\u003e\u003cdl\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-SETENV\"\u003e\u003cspan\u003e\u003ccode\u003e\\setenv \u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e [ \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the environment variable \u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e to \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e, or if the\n        \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is\n        not supplied, unsets the environment variable. Example:\n\u003c/p\u003e\u003cpre\u003etestdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\setenv PAGER less\u003c/code\u003e\u003c/strong\u003e\ntestdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\setenv LESS -imx4F\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","SourceRevision":"1b2d62b4845aa46374f2cb680f95d3392322cc8128646992ae4e18d0e7084915","ContentHash":"1f29355b5b34292827c4f0fdb210636e0858078cf578ee6216b72ca0bd615c1f","Payload":{"description":["Sets the environment variable name to value , or if the value is not supplied, unsets the environment variable. Example:"],"manual_html":"\u003cdiv\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-SETENV\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\setenv \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the environment variable \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e to \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e, or if the\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is\n        not supplied, unsets the environment variable. Example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\setenv PAGER less\u003c/code\u003e\u003c/strong\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\setenv LESS -imx4F\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","related":[{"label":"psql command-line options and complete manual","url":"/wiki/tool/psql/?v=18"}],"sections":[],"tables":[{"columns":[{"key":"command","label":"Command"},{"key":"modifiers","label":"Documented suffix modifiers"}],"key":"spellings","rows":[{"command":{"text":"\\setenv","url":"/wiki/psql/cmd-73-65-74-65-6e-76/?v=18"},"modifiers":"None listed in this signature"}],"title":"Spellings in this manual definition"}]}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":[{"Version":"18","Ordinal":0,"Command":"\\setenv","Signature":"\\setenv name [ value ]","Modifiers":[]}],"SQLState":null,"Evidence":null}
