{"Entry":{"collection":"psql","key":"cmd-65","name":"\\e","aliases":["\\e"],"metadata":{"aliases":["\\e"],"category":"Query buffer and editing","content_hash":"6b2520f2416d345215c7406bfbd887fae938387205581b9bd37f200c904332b3","derived_content_hash":"88bbecece5365c0b3df6b128166baa2d400953b5a59df7940694822c27a21931","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:44.96238+08:00","name":"\\e","name_zh":"","slug":"cmd-65","summary":"If filename is specified, the file is edited; after the editor exits, the file's content is copied into the current query buffer. If no filename is given, the current query buffer is copied to a temporary file which is then edited in the same fashion. Or, if the current query buffer is empty, the most recently executed query is copied to a temporary file and edited in the same fashion."}},"Definition":{"Collection":"psql","Key":"cmd-65","SourceDatabase":"center","Version":"18","SourceTable":"psql_command","SourceKey":"cmd-65","SourceRevision":"1b2d62b4845aa46374f2cb680f95d3392322cc8128646992ae4e18d0e7084915","Facts":{"command":"\\e","comparison_data":{"definition":"If filename is specified, the file is edited; after the editor exits, the file's content is copied into the current query buffer. If no filename is given, the current query buffer is copied to a temporary file which is then edited in the same fashion. Or, if the current query buffer is empty, the most recently executed query is copied to a temporary file and edited in the same fashion. If you edit a file or the previous query, and you quit the editor without modifying the file, the query buffer is cleared. Otherwise, the new contents of the query buffer are re-parsed according to the normal rules of psql , treating the whole buffer as a single line. Any complete queries are immediately executed; that is, if the query buffer contains or ends with a semicolon, everything up to that point is executed and removed from the query buffer. Whatever remains in the query buffer is redisplayed. Type semicolon or \\g to send it, or \\r to cancel it by clearing the query buffer. Treating the buffer as a single line primarily affects meta-commands: whatever is in the buffer after a meta-command will be taken as argument(s) to the meta-command, even if it spans multiple lines. (Thus you cannot make meta-command-using scripts this way. Use \\i for that.) If a line number is specified, psql will position the cursor on the specified line of the file or query buffer. Note that if a single all-digits argument is given, psql assumes it is a line number, not a file name. Tip See Environment , below, for how to configure and customize your editor.","modifiers":[],"signature":"\\e or \\edit [ filename ] [ line_number ]","spellings":["\\e","\\edit"]},"comparison_hash":"e303b6844ac736d7117466f7677fbe61c04f8c3e4e150ada2302950be1c4ad4d","description":["If filename is specified, the file is edited; after the editor exits, the file's content is copied into the current query buffer. If no filename is given, the current query buffer is copied to a temporary file which is then edited in the same fashion. Or, if the current query buffer is empty, the most recently executed query is copied to a temporary file and edited in the same fashion."],"description_zh":"如果指定了 filename ，则编辑该文件；编辑器退出后，文件内容将被复制到当前查询缓冲区。如果没有给出 filename ，则将当前查询缓冲区复制到临时文件中，然后以相同方式进行编辑。或者，如果当前查询缓冲区为空，则将最近执行的查询复制到临时文件中，并以相同方式进行编辑。","description_zh_html":"\u003cdd\u003e\u003cp\u003e\n        如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e，则编辑该文件；编辑器退出后，文件内容将被复制到当前查询缓冲区。如果没有给出 \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e，则将当前查询缓冲区复制到临时文件中，然后以相同方式进行编辑。或者，如果当前查询缓冲区为空，则将最近执行的查询复制到临时文件中，并以相同方式进行编辑。\n        \u003c/p\u003e\u003cp\u003e\n        如果编辑文件或上一个查询后在未修改文件的情况下退出编辑器，则查询缓冲区将被清除。否则，查询缓冲区的新内容将根据 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 的正常规则重新解析，将整个缓冲区视为单行。任何完整的查询将立即执行；也就是说，如果查询缓冲区包含分号或以分号结尾，则执行并从查询缓冲区中删除到该点的所有内容。查询缓冲区中剩余的内容将重新显示。输入分号或\u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e 发送它，或输入\u003ccode class=\"literal\"\u003e\\r\u003c/code\u003e 通过清除查询缓冲区来取消。\n        \u003c/p\u003e\u003cp\u003e\n        将缓冲区视为单行主要影响元命令：在元命令后的缓冲区将被视为元命令的参数，即使它跨越多行。（因此，不能用这种方式创建使用元命令的脚本。请使用\u003ccode class=\"command\"\u003e\\i\u003c/code\u003e。）\n        \u003c/p\u003e\u003cp\u003e\n        如果指定了行号，\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 将光标定位在文件或查询缓冲区的指定行上。请注意，如果只给出一个全是数字的参数，\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 会假定它是一个行号，而不是文件名。\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003e提示\u003c/h3\u003e\u003cp\u003e\n        关于如何配置和自定义编辑器，请参见下面的\u003ca class=\"xref\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"环境\"\u003e环境\u003c/a\u003e。\n        \u003c/p\u003e\u003c/div\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":"\\e"}],"facts_zh":[{"label":"客户端","value":"psql 18.7"},{"label":"区分大小写的写法","value":"\\e"}],"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-EDIT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\e\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\edit\u003c/code\u003e \u003ccode class=\"literal\"\u003e [\u003cspan class=\"optional\"\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e \u003c/span\u003e] [\u003cspan class=\"optional\"\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eline_number\u003c/code\u003e\u003c/em\u003e \u003c/span\u003e] \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e is\n        specified, the file is edited; after the editor exits, the file's\n        content is copied into the current query buffer. If no \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e is given, the current query\n        buffer is copied to a temporary file which is then edited in the same\n        fashion.  Or, if the current query buffer is empty, the most recently\n        executed query is copied to a temporary file and edited in the same\n        fashion.\n        \u003c/p\u003e\u003cp\u003e\n        If you edit a file or the previous query, and you quit the editor without\n        modifying the file, the query buffer is cleared.\n        Otherwise, the new contents of the query buffer are re-parsed according to\n        the normal rules of \u003cspan class=\"application\"\u003epsql\u003c/span\u003e, treating the\n        whole buffer as a single line.  Any complete queries are immediately\n        executed; that is, if the query buffer contains or ends with a\n        semicolon, everything up to that point is executed and removed from\n        the query buffer.  Whatever remains in the query buffer is\n        redisplayed.  Type semicolon or \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e to send it,\n        or \u003ccode class=\"literal\"\u003e\\r\u003c/code\u003e to cancel it by clearing the query buffer.\n        \u003c/p\u003e\u003cp\u003e\n        Treating the buffer as a single line primarily affects meta-commands:\n        whatever is in the buffer after a meta-command will be taken as\n        argument(s) to the meta-command, even if it spans multiple lines.\n        (Thus you cannot make meta-command-using scripts this way.\n        Use \u003ccode class=\"command\"\u003e\\i\u003c/code\u003e for that.)\n        \u003c/p\u003e\u003cp\u003e\n        If a line number is specified, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e will\n        position the cursor on the specified line of the file or query buffer.\n        Note that if a single all-digits argument is given,\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e assumes it is a line number,\n        not a file name.\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003eTip\u003c/h3\u003e\u003cp\u003e\n        See \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"Environment\"\u003eEnvironment\u003c/a\u003e, below, for how to\n        configure and customize your editor.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","manual_path":"app-psql.html#APP-PSQL-META-COMMAND-EDIT","modifiers":[],"related":[{"label":"\\edit","url":"/wiki/psql/cmd-65-64-69-74/?v=18"},{"label":"psql command-line options and complete manual","url":"/wiki/tool/psql/?v=18"}],"related_zh":[{"label":"\\edit","url":"/wiki/psql/cmd-65-64-69-74/?v=18"},{"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":"\\e or \\edit [ filename ] [ line_number ]","sources":[{"anchor":"APP-PSQL-META-COMMAND-EDIT","file":"app-psql.html","label":"18.7 English manual · app-psql.html","sha256":"af50448485df02bdef2b72b8347192ba029c7082b8d0392ecb17db44ad533aaf","url":"/docs/18/app-psql.html#APP-PSQL-META-COMMAND-EDIT"}],"spellings":["\\e","\\edit"],"tables":[{"columns":[{"key":"command","label":"Command"},{"key":"modifiers","label":"Documented suffix modifiers"}],"key":"spellings","rows":[{"command":{"text":"\\e","url":"/wiki/psql/cmd-65/?v=18"},"modifiers":"None listed in this signature"},{"command":{"text":"\\edit","url":"/wiki/psql/cmd-65-64-69-74/?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":"\\e","url":"/wiki/psql/cmd-65/?v=18"},"modifiers":"此语法签名未列出"},{"command":{"text":"\\edit","url":"/wiki/psql/cmd-65-64-69-74/?v=18"},"modifiers":"此语法签名未列出"}],"title":"本版手册中的写法"}],"zh_from":"same-version-manual"},"ManualEvidence":{"manual_path":"app-psql.html#APP-PSQL-META-COMMAND-EDIT","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-EDIT","file":"app-psql.html","label":"18.7 English manual · app-psql.html","sha256":"af50448485df02bdef2b72b8347192ba029c7082b8d0392ecb17db44ad533aaf","url":"/docs/18/app-psql.html#APP-PSQL-META-COMMAND-EDIT"}]},"MeasuredEvidence":{}},"Text":{"Collection":"psql","Key":"cmd-65","SourceDatabase":"center","Version":"18","Locale":"en","Title":"\\e","Summary":"If filename is specified, the file is edited; after the editor exits, the file's content is copied into the current query buffer. If no filename is given, the current query buffer is copied to a temporary file which is then edited in the same fashion. Or, if the current query buffer is empty, the most recently executed query is copied to a temporary file and edited in the same fashion.","BodyHTML":"\u003cdiv\u003e\u003cdl\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-EDIT\"\u003e\u003cspan\u003e\u003ccode\u003e\\e\u003c/code\u003e or \u003ccode\u003e\\edit\u003c/code\u003e \u003ccode\u003e [\u003cspan\u003e \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e \u003c/span\u003e] [\u003cspan\u003e \u003cem\u003e\u003ccode\u003eline_number\u003c/code\u003e\u003c/em\u003e \u003c/span\u003e] \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        If \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e is\n        specified, the file is edited; after the editor exits, the file\u0026#39;s\n        content is copied into the current query buffer. If no \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e is given, the current query\n        buffer is copied to a temporary file which is then edited in the same\n        fashion.  Or, if the current query buffer is empty, the most recently\n        executed query is copied to a temporary file and edited in the same\n        fashion.\n        \u003c/p\u003e\u003cp\u003e\n        If you edit a file or the previous query, and you quit the editor without\n        modifying the file, the query buffer is cleared.\n        Otherwise, the new contents of the query buffer are re-parsed according to\n        the normal rules of \u003cspan\u003epsql\u003c/span\u003e, treating the\n        whole buffer as a single line.  Any complete queries are immediately\n        executed; that is, if the query buffer contains or ends with a\n        semicolon, everything up to that point is executed and removed from\n        the query buffer.  Whatever remains in the query buffer is\n        redisplayed.  Type semicolon or \u003ccode\u003e\\g\u003c/code\u003e to send it,\n        or \u003ccode\u003e\\r\u003c/code\u003e to cancel it by clearing the query buffer.\n        \u003c/p\u003e\u003cp\u003e\n        Treating the buffer as a single line primarily affects meta-commands:\n        whatever is in the buffer after a meta-command will be taken as\n        argument(s) to the meta-command, even if it spans multiple lines.\n        (Thus you cannot make meta-command-using scripts this way.\n        Use \u003ccode\u003e\\i\u003c/code\u003e for that.)\n        \u003c/p\u003e\u003cp\u003e\n        If a line number is specified, \u003cspan\u003epsql\u003c/span\u003e will\n        position the cursor on the specified line of the file or query buffer.\n        Note that if a single all-digits argument is given,\n        \u003cspan\u003epsql\u003c/span\u003e assumes it is a line number,\n        not a file name.\n        \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eTip\u003c/h3\u003e\u003cp\u003e\n        See \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"Environment\" rel=\"nofollow\"\u003eEnvironment\u003c/a\u003e, below, for how to\n        configure and customize your editor.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","SourceRevision":"1b2d62b4845aa46374f2cb680f95d3392322cc8128646992ae4e18d0e7084915","ContentHash":"2088acc8dc35c07e3e4677f153a7625283d74dd6f7c813c951e21e1d6747d4a9","Payload":{"description":["If filename is specified, the file is edited; after the editor exits, the file's content is copied into the current query buffer. If no filename is given, the current query buffer is copied to a temporary file which is then edited in the same fashion. Or, if the current query buffer is empty, the most recently executed query is copied to a temporary file and edited in the same fashion."],"manual_html":"\u003cdiv\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-EDIT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\e\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\edit\u003c/code\u003e \u003ccode class=\"literal\"\u003e [\u003cspan class=\"optional\"\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e \u003c/span\u003e] [\u003cspan class=\"optional\"\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eline_number\u003c/code\u003e\u003c/em\u003e \u003c/span\u003e] \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e is\n        specified, the file is edited; after the editor exits, the file's\n        content is copied into the current query buffer. If no \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e is given, the current query\n        buffer is copied to a temporary file which is then edited in the same\n        fashion.  Or, if the current query buffer is empty, the most recently\n        executed query is copied to a temporary file and edited in the same\n        fashion.\n        \u003c/p\u003e\u003cp\u003e\n        If you edit a file or the previous query, and you quit the editor without\n        modifying the file, the query buffer is cleared.\n        Otherwise, the new contents of the query buffer are re-parsed according to\n        the normal rules of \u003cspan class=\"application\"\u003epsql\u003c/span\u003e, treating the\n        whole buffer as a single line.  Any complete queries are immediately\n        executed; that is, if the query buffer contains or ends with a\n        semicolon, everything up to that point is executed and removed from\n        the query buffer.  Whatever remains in the query buffer is\n        redisplayed.  Type semicolon or \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e to send it,\n        or \u003ccode class=\"literal\"\u003e\\r\u003c/code\u003e to cancel it by clearing the query buffer.\n        \u003c/p\u003e\u003cp\u003e\n        Treating the buffer as a single line primarily affects meta-commands:\n        whatever is in the buffer after a meta-command will be taken as\n        argument(s) to the meta-command, even if it spans multiple lines.\n        (Thus you cannot make meta-command-using scripts this way.\n        Use \u003ccode class=\"command\"\u003e\\i\u003c/code\u003e for that.)\n        \u003c/p\u003e\u003cp\u003e\n        If a line number is specified, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e will\n        position the cursor on the specified line of the file or query buffer.\n        Note that if a single all-digits argument is given,\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e assumes it is a line number,\n        not a file name.\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003eTip\u003c/h3\u003e\u003cp\u003e\n        See \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"Environment\"\u003eEnvironment\u003c/a\u003e, below, for how to\n        configure and customize your editor.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","related":[{"label":"\\edit","url":"/wiki/psql/cmd-65-64-69-74/?v=18"},{"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":"\\e","url":"/wiki/psql/cmd-65/?v=18"},"modifiers":"None listed in this signature"},{"command":{"text":"\\edit","url":"/wiki/psql/cmd-65-64-69-74/?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":"\\e","Signature":"\\e or \\edit [ filename ] [ line_number ]","Modifiers":[]},{"Version":"18","Ordinal":1,"Command":"\\edit","Signature":"\\e or \\edit [ filename ] [ line_number ]","Modifiers":[]}],"SQLState":null,"Evidence":null}
